|

楼主 |
发表于 2022-5-2 23:23:59
|
显示全部楼层
https://blog.csdn.net/ljlchrr/article/details/84025848按照这篇文章的代码,数据内容和上面的基本一致。下面是具体报错内容:
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\ops.py:816: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
result = getattr(x, name)(y)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-23-64df86877057> in <module>()
4 data_gender = data[['Student ID','Correct','Score','Problem ID','Assignment ID','Assignment Title']]
5 #筛选Place中地点为A 的数据
----> 6 FF = data_gender.loc[(data_gender['Problem ID'] == '514524')]
7 print(data_gender.loc[(data_gender['Problem ID'] == '514524')])
8 FF.to_csv('test1.xlsx',index=False,encoding = 'gbk') #生成excel文件
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\ops.py in wrapper(self, other, axis)
877
878 with np.errstate(all='ignore'):
--> 879 res = na_op(values, other)
880 if is_scalar(res):
881 raise TypeError('Could not compare {typ} type with Series'
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\ops.py in na_op(x, y)
816 result = getattr(x, name)(y)
817 if result is NotImplemented:
--> 818 raise TypeError("invalid type comparison")
819 except AttributeError:
820 result = op(x, y)
TypeError: invalid type comparison |
|