首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >csv中数据的Pandas分析

csv中数据的Pandas分析
EN

Stack Overflow用户
提问于 2016-03-22 17:16:37
回答 1查看 125关注 0票数 0

我正在尝试使用pandas编写一个统计模型。首先,我想对价格做一个简单的均值和中位数检查。我已经在下面的csv中显示了数据。

我尝试过的:

代码语言:javascript
运行
复制
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中的数据:

代码语言:javascript
运行
复制
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)/
EN

回答 1

Stack Overflow用户

发布于 2016-03-22 18:34:57

首先,你需要从你的数据框中去掉那些"/“和",”。对于列的平均值,可以使用pandas中的df.mean()函数。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36150334

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档