新聞中心
這里有您想知道的互聯(lián)網營銷解決方案
創(chuàng)新互聯(lián)Python教程:python中pandas的知識點整理
說明

主要從事網頁設計、PC網站建設(電腦版網站建設)、wap網站建設(手機版網站建設)、成都響應式網站建設、程序開發(fā)、微網站、微信平臺小程序開發(fā)等,憑借多年來在互聯(lián)網的打拼,我們在互聯(lián)網網站建設行業(yè)積累了豐富的成都網站設計、成都網站制作、網絡營銷經驗,集策劃、開發(fā)、設計、營銷、管理等多方位專業(yè)化運作于一體,具備承接不同規(guī)模與類型的建設項目的能力。
1、python+data+analysis的組合縮寫,是python中以numpy和matplotlib為基礎的第三方數(shù)據(jù)分析庫
2、共同構成python數(shù)據(jù)分析的基本工具包,享有三個劍客的名字。
安裝
打開cmd,依次輸入以下三個命令。
pip install Pandas -i https://pypi.tuna.tsinghua.edu.cn/simple pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple
pandas選擇數(shù)據(jù)
import pandas as pd
import numpy as np
dates = pd.date_range('20210301', periods=6)
df1 = pd.DataFrame(np.arange(24).reshape((6, 4)), index=dates, columns=['A', 'B', 'C', 'D'])
print(df1)pandas賦值及操作
import pandas as pd
import numpy as np
dates = pd.date_range('20210301', periods=6)
df1 = pd.DataFrame(np.arange(24).reshape((6, 4)), index=dates, columns=['A', 'B', 'C', 'D'])
print(df1)pandas對于空數(shù)據(jù)的處理
import pandas as pd
import numpy as np
dates = pd.date_range('20210301', periods=6)
df1 = pd.DataFrame(np.arange(24).reshape((6, 4)), index=dates, columns=['A', 'B', 'C', 'D'])
df2 = pd.DataFrame(df1, index=dates, columns=['A', 'B', 'C', 'D', 'E', 'F'])
s1 = pd.Series([3, 4, 6, 7], index=dates[:4]) # 對第一個到第四個數(shù)據(jù)進行賦值
s2 = pd.Series([32, 5, 2, 1], index=dates[2:]) # 對第三個數(shù)據(jù)到最后一個數(shù)據(jù)進行賦值
df2['E'] = s1
df2['F'] = s2
print(df2)以上就是python中pandas的知識點整理,希望對大家有所幫助。更多Python學習指路:創(chuàng)新互聯(lián)Python教程
本文教程操作環(huán)境:windows7系統(tǒng)、Python 3.9.1,DELL G3電腦。
當前文章:創(chuàng)新互聯(lián)Python教程:python中pandas的知識點整理
網站URL:http://www.5511xx.com/article/cdgicej.html


咨詢
建站咨詢
