Skip to content

Commit

Permalink
Improve example management
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Oct 30, 2024
1 parent 118ef66 commit 93a0034
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/data_common/dataset/resource_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_order(self, native_order: int = 999) -> int:
old_style = desc.get("_sheet_order", None)
if old_style:
return old_style
return desc.get("custom", []).get("dataset_order", native_order)
return desc.get("custom", {}).get("dataset_order", native_order)

@property
def resource_path(self) -> Path:
Expand Down
7 changes: 6 additions & 1 deletion src/data_common/dataset/table_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ def get_example(series: pd.Series) -> str | int | float:
item = series
if len(item) == 0:
return ""
item = item[0]
if isinstance(item, dict):
return str(item)
if isinstance(item, pd.Series):
item = item.iloc[0]
else:
item = str(item[0])
if isinstance(item, bool):
return str(item)
if isinstance(item, float):
Expand Down

0 comments on commit 93a0034

Please sign in to comment.