我正在学习一门复数课程来学习 Python 数据操作,但在第一个模块中出现了错误!我正在使用带有 Python 3.7 和 Pandas 1.0.1 的 Jupyter Notebooks。有人可以帮忙吗?
import pandas as pd
data = pd.read_csv('artwork_sample.csv')
data.dtypes
回报:
id int64
accession_number object
artist object
artistRole object
artistId int64
title object
dateText object
medium object
creditLine object
year float64
acquisitionYear int64
dimensions object
width int64
height int64
depth float64
units object
inscription float64
thumbnailCopyright float64
thumbnailUrl object
url object
dtype: 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'
jeck猫
相关分类