flat_table icon indicating copy to clipboard operation
flat_table copied to clipboard

Bug when expanding dataframe

Open RNogales94 opened this issue 5 years ago • 1 comments

Trying to expand a dataframe: expanded_df = flat_table.normalize(df, expand_lists=True, expand_dicts=True)
I got a bad shape after expanded_df

My df structure is like this:

Intents Clean_Description Clean_Short_Description Algorithm System Is_ata Language ShortDescription Description
[] v v Intent_similarity ISA FALSE en v v
[] d c Intent_similarity ISA FALSE en c d
[{'Prediction': 'Intent2094', 'Similarity_score': 0.6559049986732967, 'Threshold': 0.5, 'Confident': True, 'Closest_email_ID': '10301533'}] f a Email_similarity APA FALSE en a f

But the output is only one row well formatted, but only one row, the one which has the list inside

What's wrong with my code?

RNogales94 avatar Mar 03 '20 11:03 RNogales94

I am sorry for the late reply, @RNogales94. If it is still useful, I figured what's wrong with the data frame.

For lists or dicts to expand, they need to be deserialized for flat_table to work. You need to use literal_eval to convert df.Intents to python list. I made a notebook for it. You can check it out.

Hope this helps.

metinsenturk avatar Aug 23 '20 18:08 metinsenturk