美文网首页我爱编程
python之pandas 重用方法

python之pandas 重用方法

作者: Michael_zmh | 来源:发表于2018-07-23 15:16 被阅读0次
    • (ix & iloc & loc) 的区别:
      loc——通过行标签索引行数据
      iloc——通过行号索引行数据
      ix——通过行标签或者行号索引行数据(基于loc和iloc 的混合) (DeprecationWarning)

    • python DataFrame获取行数、列数、索引及第几行第几列的值:

    df = DataFrame([{‘A’:’11’,’B’:’12’},
                    {‘A’:’111’,’B’:’121’},
                    {‘A’:’1111’,’B’:’1211’}])
    print df.columns.size    #列数 2
    print df.iloc[:,0].size    #行数 3
    print df.ix[[0]].index.values[0]    #索引值 0
    print df.ix[[0]].values[0][0]    #第一行第一列的值 11
    print df.ix[[1]].values[0][1]    #第二行第二列的值 121
    

    相关文章

      网友评论

        本文标题:python之pandas 重用方法

        本文链接:https://www.haomeiwen.com/subject/hjljmftx.html