本文通過一個(gè)csv實(shí)例文件來展示如何刪除Pandas.DataFrame的行和列
成都創(chuàng)新互聯(lián)公司專注于企業(yè)成都全網(wǎng)營(yíng)銷、網(wǎng)站重做改版、丘北網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、html5、商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)營(yíng)銷網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為丘北等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。數(shù)據(jù)文件名為:example.csv
內(nèi)容為:
date | spring | summer | autumn | winter |
---|---|---|---|---|
2000 | 12.2338809 | 16.90730113 | 15.69238313 | 14.08596223 |
2001 | 12.84748057 | 16.75046873 | 14.51406637 | 13.5037456 |
2002 | 13.558175 | 17.2033926 | 15.6999475 | 13.23365247 |
2003 | 12.6547247 | 16.89491533 | 15.6614647 | 12.84347867 |
2004 | 13.2537298 | 17.04696657 | 15.20905377 | 14.3647912 |
2005 | 13.4443049 | 16.7459822 | 16.62218797 | 11.61082257 |
2006 | 13.50569567 | 16.83357857 | 15.4979282 | 12.19934363 |
2007 | 13.48852623 | 16.66773283 | 15.81701437 | 13.7438216 |
2008 | 13.1515319 | 16.48650693 | 15.72957287 | 12.93233587 |
2009 | 13.45771543 | 16.63923783 | 18.26017997 | 12.65315943 |
2010 | 13.1945485 | 16.7286889 | 15.42635267 | 13.8833583 |
2011 | 14.34779417 | 16.68942103 | 14.17658043 | 12.36654197 |
2012 | 13.6050867 | 17.13056773 | 14.71796777 | 13.29255243 |
2013 | 13.02790787 | 17.38619343 | 16.20345497 | 13.18612133 |
2014 | 12.74668163 | 16.54428687 | 14.7367682 | 12.87065125 |
2015 | 13.465904 | 16.50612317 | 12.44243663 | 11.0181384 |
season | spring | summer | autumn | winter |
slope | 0.0379691374 | -0.01164689167 | -0.07913844113 | -0.07765274553 |
刪除行
In [1]: import numpy as np import pandas as pd odata = pd.read_csv('example.csv') odata Out[1]: date spring summer autumn winter 0 2000 12.2338809 16.9073011333 15.6923831333 14.0859622333 1 2001 12.8474805667 16.7504687333 14.5140663667 13.5037456 2 2002 13.558175 17.2033926 15.6999475 13.2336524667 3 2003 12.6547247 16.8949153333 15.6614647 12.8434786667 4 2004 13.2537298 17.0469665667 15.2090537667 14.3647912 5 2005 13.4443049 16.7459822 16.6221879667 11.6108225667 6 2006 13.5056956667 16.8335785667 15.4979282 12.1993436333 7 2007 13.4885262333 16.6677328333 15.8170143667 13.7438216 8 2008 13.1515319 16.4865069333 15.7295728667 12.9323358667 9 2009 13.4577154333 16.6392378333 18.2601799667 12.6531594333 10 2010 13.1945485 16.7286889 15.4263526667 13.8833583 11 2011 14.3477941667 16.6894210333 14.1765804333 12.3665419667 12 2012 13.6050867 17.1305677333 14.7179677667 13.2925524333 13 2013 13.0279078667 17.3861934333 16.2034549667 13.1861213333 14 2014 12.7466816333 16.5442868667 14.7367682 12.8706512467 15 2015 13.465904 16.5061231667 12.4424366333 11.0181384 16 season spring summer autumn winter 17 slope 0.037969137402 -0.0116468916667 -0.0791384411275 -0.0776527455294
網(wǎng)站名稱:使用DataFrame刪除行和列的實(shí)例講解-創(chuàng)新互聯(lián)
標(biāo)題來源:http://aaarwkj.com/article42/ccdihc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、手機(jī)網(wǎng)站建設(shè)、Google、全網(wǎng)營(yíng)銷推廣、虛擬主機(jī)、做網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容