【问题描述】
在将dict转为DataFrame时会报错:If using all scalar values, you must pass an index
例如:
summary = pd.DataFrame({key:value for key,value in test.items()if key in index}) #查看汇总表情况
【解决办法】
添加参数:index = [0]
summary = pd.DataFrame({key:value for key,value in test.items()if key in index},index = [0]) #查看汇总表情况
没报错!问题解决!
(仅供个人学习,不负责任~~~~~~~~~~~~)