Skip to content

Commit

Permalink
fix: get_series empty dataframe handling and column rename
Browse files Browse the repository at this point in the history
  • Loading branch information
csautter committed Oct 6, 2024
1 parent 4088982 commit 4ccc889
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions myeia/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,16 @@ def get_series(
df = df.sort_index(ascending=False)
df[data_identifier] = df[data_identifier].astype(float)

# Filtering the DataFrame by the specified date range can result in an empty DataFrame
if df.empty:
return df

for col in df.columns:
if "name" in col.lower() or "description" in col.lower():
df = df.rename(columns={data_identifier: df[col][0]})
df = df[df[col][0]].to_frame()
break

return df

def get_series_via_route(
Expand Down

0 comments on commit 4ccc889

Please sign in to comment.