Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/312.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 csv中的数据分析_Python_Pandas - Fatal编程技术网

Python csv中的数据分析

Python csv中的数据分析,python,pandas,Python,Pandas,我正试图用熊猫编码一个统计模型。首先我想做一个简单的价格均值和中位数检查。我已经在下面的csv中显示了数据 我所尝试的: import pandas df = pandas.read_csv('audi-a4.csv', index_col=False, header=0); serie = df.transpose() # here we convert the DataFrame into a Se x = serie.describe() print(serie) print(x) C

我正试图用熊猫编码一个统计模型。首先我想做一个简单的价格均值和中位数检查。我已经在下面的csv中显示了数据

我所尝试的:

import pandas

df = pandas.read_csv('audi-a4.csv', index_col=False, header=0);
serie = df.transpose() # here we convert the DataFrame into a Se
x = serie.describe()
print(serie)
print(x)
CSV格式的数据:

NoteDate    Fuel    StartDate   BestContactTime PriceDisplay    IsBold  Make    Transmission    Category    Owners  HasFreeShipping Year    EngineSize  AsAt    IsDealer    Doors   ExteriorColour  Odometer    StartPrice  NumberPlate ImportHistory   EndDate Cylinders   Title   Vin CategoryPath    WofExpires  BodyStyle   ListingLength   Suburb  StereoDescription   ListingId   Region  Model   RegistrationExpires
    /Date(0)/   Petrol  /Date(1457523875033)/   Evening $17,985 TRUE    Audi    Automatic   0001-0268-0271- 0   TRUE    2005    2000    /Date(1457854140345)/   FALSE   0   Dark Blue   61988   17985   ABC123      /Date(1458128675033)/   0   Audi A4 Test887 2005    WAUZZZ8EX5A457186   /Trade-Me-Motors/Cars/Audi  /Date(0)/   Sedan       Whangarei       4554769 Northland   A4  /Date(0)/
    /Date(0)/   Petrol  /Date(1457525091850)/   Evening $17,985 TRUE    Audi    Automatic   0001-0268-0271- 0   TRUE    2005    2000    /Date(1457854140345)/   FALSE   0   Dark Blue   61988   17985   ABC123      /Date(1458129891850)/   0   Audi A4 Test biz1 2005  WAUZZZ8EX5A457186   /Trade-Me-Motors/Cars/Audi  /Date(0)/   Sedan       Whangarei       4554770 Northland   A4  /Date(0)/
    /Date(0)/   Petrol  /Date(1457530941643)/   Evening $17,985 TRUE    Audi    Automatic   0001-0268-0271- 0   TRUE    2005    2000    /Date(1457854140345)/   FALSE   0   Dark Blue   61988   17985   ABC123      /Date(1458135741643)/   0   Audi A4 Test123 2005    WAUZZZ8EX5A457186   /Trade-Me-Motors/Cars/Audi  /Date(0)/   Sedan       Whangarei       4554773 Northland   A4  /Date(0)/
    /Date(0)/   Petrol  /Date(1457532268097)/   Evening $17,985 TRUE    Audi    Automatic   0001-0268-0271- 0   TRUE    2005    2000    /Date(1457854140345)/   FALSE   0   Dark Blue   61988   17985   ABC123      /Date(1458137068097)/   0   Audi A4 Luxary Ship for Sale 2005   WAUZZZ8EX5A457186   /Trade-Me-Motors/Cars/Audi  /Date(0)/   Sedan       Whangarei       4554774 Northland   A4  /Date(0)/
    /Date(0)/   Petrol  /Date(1457612061090)/   Evening $17,985 TRUE    Audi    Automatic   0001-0268-0271- 0   TRUE    2005    2000    /Date(1457854140345)/   FALSE   0   Dark Blue   61988   17985   ABC123      /Date(1458216861090)/   0   Audi A4 Well Established, EST T/O $8.8M, Owne 2005  WAUZZZ8EX5A457186   /Trade-Me-Motors/Cars/Audi  /Date(0)/   Sedan       Whangarei       4557063 Northland   A4  /Date(0)/

首先,您需要从数据帧中取出这些“/”和“,”。对于列的平均值,可以使用pandas中的df.mean()函数。

为什么需要转换为序列?还有,这个csv片段真的是csv的样子吗?因为您的代码不能正确解析它,因为您有空格分隔符而没有逗号,为什么您的一些数据中有
/