Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Panda AttributeError:';系列';对象没有属性';aType';_Python_Python 3.x_Pandas - Fatal编程技术网

Python 使用Panda AttributeError:';系列';对象没有属性';aType';

Python 使用Panda AttributeError:';系列';对象没有属性';aType';,python,python-3.x,pandas,Python,Python 3.x,Pandas,我正在学习一门pluralsight课程来学习Python数据操作,但在第一个模块中出现了一个错误!我使用的是Jupyter笔记本电脑,包括Python 3.7和Pandas 1.0.1。有人能帮忙吗 import pandas as pd data = pd.read_csv('artwork_sample.csv') data.dtypes 返回: id int64 accession_number object artist

我正在学习一门pluralsight课程来学习Python数据操作,但在第一个模块中出现了一个错误!我使用的是Jupyter笔记本电脑,包括Python 3.7和Pandas 1.0.1。有人能帮忙吗

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
然后

产生以下错误:

---------------------------------------------------------------------------
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'
---------------------------------------------------------------------------
AttributeError回溯(最近一次呼叫上次)
在里面
---->1.data.acquisitionEAR.asType(浮点)
C:\ProgramData\Anaconda3\lib\site packages\pandas\core\generic.py in\uuuuuu getattr\uuuuuu(self,name)
5272如果自身信息轴可容纳标识符且容纳名称(名称):
5273返回自我[姓名]
->5274返回对象。\uuuu getattribute\uuu74(self,name)
5275
5276定义设置属性(self,名称:str,值)->无:
AttributeError:“Series”对象没有属性“asType”
看起来像是asType中的一种大写字母
我查找了大写字母,但找不到。

这是打字错误
asType
-需要
asType
---------------------------------------------------------------------------
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'