程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[p15 Python basics] pandas

編輯:Python

Pandas

  • 1 data structure Series
  • 2 data structure DataFrame
  • 3 Pandas Indexes
    • 3.1 Series One dimensional index
    • 3.2 DataFrame Multidimensional index



1 data structure Series


import numpy as np
import pandas as pd
arr1=np.arange(3,10)
s1=pd.Series(arr1)
print(s1)


import numpy as np
import pandas as pd
dic={'a':10,'b':20,'c':30,'d':40,'e':50}
s1=pd.Series(dic)
print(s1)

2 data structure DataFrame


import numpy as np
import pandas as pd
arr1=np.arange(3,15).reshape(4,3)
df1=pd.DataFrame(arr1)
print(df1)


import numpy as np
import pandas as pd
dic={'a':[1,2,3,4],'b':[5,6,7,8],'c':[9,12,11,12],'d':[13,14,15,16]}# Created through a dictionary , Labels are stored in columns
df1=pd.DataFrame(dic)
print(df1)

# Created through a dictionary , Labels are stored in columns

Column names and indexes can be changed


3 Pandas Indexes

3.1 Series One dimensional index

3.2 DataFrame Multidimensional index

0 No. label removal , The first 0 That's ok


Notice the label slice here , It's the end ,,, It's different from before







  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved