我正在學(xué)習(xí)一門復(fù)數(shù)課程來學(xué)習(xí) Python 數(shù)據(jù)操作,但在第一個(gè)模塊中出現(xiàn)了錯(cuò)誤!我正在使用帶有 Python 3.7 和 Pandas 1.0.1 的 Jupyter Notebooks。有人可以幫忙嗎?import pandas as pddata = pd.read_csv('artwork_sample.csv')data.dtypes回報(bào):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)產(chǎn)生此錯(cuò)誤:---------------------------------------------------------------------------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貢獻(xiàn)1909條經(jīng)驗(yàn) 獲得超7個(gè)贊
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.astype.html 貌似是asType中的一種大寫字母,我找了大寫字母也沒找到。
添加回答
舉報(bào)
0/150
提交
取消