2017-07-13 5 views

答えて

1

あなたは、列を反復し、あなたの基準を満たしていないものをドロップすることができます:

pvt = pd.pivot_table(df, index='month', columns = ['metro'], aggfunc = { 'metro' : 'count' } ) 

for col in pvt.columns: 
    if not any(pvt[col] > 10): 
     pvt.drop(col,axis=1,inplace=True) 
+0

注:ここでdfは質問で与えたピボットテーブルの結果を参照します。 –

+0

はい、ありがとう - 私はそれを(うまくいけば)より明確にするために私の答えを編集します – Greg

関連する問題