pandas: dataframe转字典,并设置key
解决方案
res = df_by_monthly.set_index('recruit_resign_month').T.to_dict('list')
print(res)
上述代码是转为列表形式
转为字典形式
res = df_by_monthly.set_index('recruit_resign_month').T.to_dict()
print(res)
参考链接
https://www.cxybb.com/article/zx1245773445/103480750
https://blog.csdn.net/zx1245773445/article/details/103480750
https://blog.csdn.net/zx1245773445/article/details/103480750
学以致用,知行合一