To get a row of data in pandas by index I can do:
df.loc[100].tolist()
Is there a way to get that row of data as a dict, other than doing:
dict(zip(df.columns.tolist(),df.loc[100], tolist()
))
To get a row of data in pandas by index I can do:
df.loc[100].tolist()
Is there a way to get that row of data as a dict, other than doing:
dict(zip(df.columns.tolist(),df.loc[100], tolist()
))
Try with to_dict
df.loc[1].to_dict()