久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      最全的Python pandas用法總結(jié)

      最全的Python pandas用法總結(jié)

      一、生成數(shù)據(jù)表

      1、首先導(dǎo)入pandas庫(kù),一般都會(huì)用到numpy庫(kù),所以我們先導(dǎo)入備用:

      import numpy as np import pandas as pd

      2、導(dǎo)入CSV或者xlsx文件:

      df = pd.DataFrame(pd.read_csv('name.csv',header=1)) df = pd.DataFrame(pd.read_excel('name.xlsx'))

      3、用pandas創(chuàng)建數(shù)據(jù)表:

      df = pd.DataFrame({"id":[1001,1002,1003,1004,1005,1006],   "date":pd.date_range('20130102', periods=6),  "city":['Beijing ', 'SH', ' guangzhou ', 'Shenzhen', 'shanghai', 'BEIJING '],  "age":[23,44,54,32,34,32],  "category":['100-A','100-B','110-A','110-C','210-A','130-F'],  "price":[1200,np.nan,2133,5433,np.nan,4432]}, columns =['id','date','city','category','age','price'])

      二、數(shù)據(jù)表信息查看

      1、維度查看:

      df.shape

      2、數(shù)據(jù)表基本信息(維度、列名稱、數(shù)據(jù)格式、所占空間等):

      df.info()

      3、每一列數(shù)據(jù)的格式:

      df.dtypes

      4、某一列格式:

      df['B'].dtype

      5、空值:

      df.isnull()

      6、查看某一列空值:

      df.isnull()

      7、查看某一列的唯一值:

      df['B'].unique()

      8、查看數(shù)據(jù)表的值:

      df.values

      9、查看列名稱:

      df.columns

      10、查看前10行數(shù)據(jù)、后10行數(shù)據(jù):

      df.head() #默認(rèn)前10行數(shù)據(jù) df.tail()    #默認(rèn)后10 行數(shù)據(jù)

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)