I have a data frame with the nested fields. I need to extract only the display_value from the columns:
How to make my code efficient?
df['author'] = df['author'].str.get('display_value')
df['assigned'] = df['assigned'].str.get('display_value')
df['closed'] = df['closed'].str.get('display_value')
df['service'] = df['service'].str.get('display_value')
Thanks
CodePudding user response:
This is cleaner and more efficient:
for column in df.columns:
df[column] = df[column].str.get('display_value')