Skip to content

Commit

Permalink
Fix for all obj type df (#594)
Browse files Browse the repository at this point in the history
Co-authored-by: Demetris Roumis <[email protected]>
  • Loading branch information
ahuang11 and droumis authored Jul 3, 2024
1 parent 5594067 commit a2e74f5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lumen/ai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ def format_float(num):
if isinstance(df[col].iloc[0], pd.Timestamp):
df[col] = pd.to_datetime(df[col])

df_describe_dict = df.describe(percentiles=[]).drop(["min", "max"]).to_dict()
describe_df = df.describe(percentiles=[])
columns_to_drop = ["min", "max"] # present if any numeric
columns_to_drop = [col for col in columns_to_drop if col in describe_df.columns]
df_describe_dict = describe_df.drop(columns=columns_to_drop).to_dict()

for col in df.select_dtypes(include=["object"]).columns:
if col not in df_describe_dict:
Expand Down

0 comments on commit a2e74f5

Please sign in to comment.