1
我有一個整數列的熊貓數據框。我想包含數字比10。我能夠評估真或假,但不是實際的值越大,行,這樣做:如何在大熊貓中選擇和存儲大於數字的列?
df['ints'] = df['ints'] > 10
我不使用Python很多時候,所以我轉圈圈有了這個。
我花了20分鐘,但谷歌搜索一直沒能找到我需要的....
編輯:
observationID recordKey gridReference siteKey siteName featureKey startDate endDate pTaxonVersionKey taxonName authority commonName ints
0 463166539 1767 SM90 NaN NaN 150161 12/02/2006 12/02/2006 NBNSYS0100004720 Pipistrellus pygmaeus (Leach, 1825) Soprano Pipistrelle 2006
1 463166623 4325 TL65 NaN NaN 168651 21/12/2008 21/12/2008 NHMSYS0020001355 Pipistrellus pipistrellus sensu stricto (Schreber, 1774) Common Pipistrelle 2008
2 463166624 4326 TL65 NaN NaN 168651 18/01/2009 18/01/2009 NHMSYS0020001355 Pipistrellus pipistrellus sensu stricto (Schreber, 1774) Common Pipistrelle 2009
3 463166625 4327 TL65 NaN NaN 168651 15/02/2009 15/02/2009 NHMSYS0020001355 Pipistrellus pipistrellus sensu stricto (Schreber, 1774) Common Pipistrelle 2009
4 463166626 4328 TL65 NaN NaN 168651 19/12/2009 19/12/2009 NHMSYS0020001355 Pipistrellus pipistrellus sensu stricto (Schreber, 1774) Common Pipistrelle 2009
我做了'df ['ints'] = df [df.ints> 10]'執行。現在當我做'df ['ints']。min()'我得到'ValueError:不能將浮點數NaN轉換爲整數'? –
@VinylWarmth,你的目標是什麼?你想實現什麼?你想擺脫行'df.ints <= 10' – MaxU
我想'df ['ints']'只包含其中'df ['ints']'大於10的行.. –