I have a pandas dataframe that is rows of dictionaries, I need to convert the values of those dictionaries to lists with a list comprehension and a for loop.pandas dataframe contact_info_dfthe expected results
I tried
# Iterate through the contact_info_df and convert each row to a dictionary.
import json
dict_values = []
for row in contact_info_df:
dict_values.append(list(contact_info_df[row]))
# Print out the list of values for each row.
print(dict_values)
What I got was results of my code
New contributor
Nicole Henderson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.