亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 Panda AttributeError 的 Python 錯誤:“系列”對象沒有屬性

使用 Panda AttributeError 的 Python 錯誤:“系列”對象沒有屬性

catspeake 2022-10-25 14:49:15
我正在學習一門復數課程來學習 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中的一種大寫字母,我找了大寫字母也沒找到。



查看完整回答
反對 回復 2022-10-25
  • 1 回答
  • 0 關注
  • 183 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號