zoukankan      html  css  js  c++  java
  • pandas.read_csv 参数 index_col=0

    index_col : int or sequence or False, default None

    用作行索引的列编号或者列名,如果给定一个序列则有多个行索引。
    如果文件不规则,行尾有分隔符,则可以设定index_col=False 来使得pandas不使用第一列作为行索引。
     
    如:
    train_df = pd.read_csv('./input/train.csv')
    print train_df.columns
    结果:

    Index([u'Id', u'MSSubClass', u'MSZoning', u'LotFrontage', u'LotArea',
    u'Street', u'Alley', u'LotShape', u'LandContour', u'Utilities',
    u'LotConfig', u'LandSlope', u'Neighborhood', u'Condition1',
    u'Condition2', u'BldgType', u'HouseStyle', u'OverallQual',
    u'OverallCond', u'YearBuilt', u'YearRemodAdd', u'RoofStyle',
    u'RoofMatl', u'Exterior1st', u'Exterior2nd', u'MasVnrType',。。。]

    train_df = pd.read_csv('./input/train.csv', index_col=0)
    结果:

    Index([u'MSSubClass', u'MSZoning', u'LotFrontage', u'LotArea', u'Street',
    u'Alley', u'LotShape', u'LandContour', u'Utilities', u'LotConfig',
    u'LandSlope', u'Neighborhood', u'Condition1', u'Condition2',
    u'BldgType', u'HouseStyle', u'OverallQual', u'OverallCond',
    u'YearBuilt', u'YearRemodAdd', u'RoofStyle', u'RoofMatl',
    u'Exterior1st', u'Exterior2nd', u'MasVnrType',。。。]



  • 相关阅读:
    四则运算
    软工与我
    四则运算结对作业
    《构建之法》读第四、十七章收获
    2016012088四则运算
    构建之法第一、二、十六章
    我的软件工程之路
    小学四则运算结对项目报告【GUI】
    构建之法4,17章读书笔记
    2016012095+小学四则远算练习软件项目报告
  • 原文地址:https://www.cnblogs.com/TMatrix52/p/7717756.html
Copyright © 2011-2022 走看看