Skip to content

Commit

Permalink
fix: 🐛 preserve order of the columns when infered from the rows (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
severo authored Feb 15, 2022
1 parent 93c218e commit a98f857
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Sylvain Lesage <[email protected]>"]
description = "API to extract rows of 🤗 datasets"
name = "datasets-preview-backend"
version = "0.16.18"
version = "0.16.19"

[tool.poetry.dependencies]
Pillow = "^8.4.0"
Expand Down
4 changes: 3 additions & 1 deletion src/datasets_preview_backend/models/column/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ def get_columns(info: Info, rows: List[Row]) -> List[Column]:
return []
else:
column_names = list(
{column_name for row in rows[:MAX_ROWS_FOR_TYPE_INFERENCE_AND_CHECK] for column_name in row.keys()}
dict.fromkeys(
column_name for row in rows[:MAX_ROWS_FOR_TYPE_INFERENCE_AND_CHECK] for column_name in row.keys()
)
)
else:
column_names = list(features.keys())
Expand Down

0 comments on commit a98f857

Please sign in to comment.