我正在学习一门复数课程来学习 Python 数据操作,但在第一个模块中出现了错误!我正在使用带有 Python 3.7 和 Pandas 1.0.1 的 Jupyter Notebooks。有人可以帮忙吗?import pandas as pddata = pd.read_csv('artwork_sample.csv')data.dtypes回报:id int64accession_number objectartist objectartistRole objectartistId int64title objectdateText objectmedium objectcreditLine objectyear float64acquisitionYear int64dimensions objectwidth int64height int64depth float64units objectinscription float64thumbnailCopyright float64thumbnailUrl objecturl objectdtype: object然后data.acquisitionYear.asType(float)产生此错误:---------------------------------------------------------------------------AttributeError Traceback (most recent call last)<ipython-input-19-9daf408c9065> in <module>----> 1 data.acquisitionYear.asType(float)C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name) 5272 if self._info_axis._can_hold_identifiers_and_holds_name(name): 5273 return self[name]-> 5274 return object.__getattribute__(self, name) 5275 5276 def __setattr__(self, name: str, value) -> None:AttributeError: 'Series' object has no attribute 'asType'
1 回答

jeck猫
TA贡献1909条经验 获得超7个赞
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.astype.html 貌似是asType中的一种大写字母,我找了大写字母也没找到。
添加回答
举报
0/150
提交
取消