0
IM仍然很新的大熊貓.. 我設法收到以下GROUPBY子句的系列:後熊貓groupby.value_counts()如何篩選結果?
data.groupby("salary_percentile").early_quitter.value_counts(normalize = True)
Out:
salary_percentile early_quitter
[17000, 25000] 0 0.744526
1 0.255474
(25000, 30000] 0 0.751880
1 0.248120
(30000, 38000] 0 0.701799
1 0.298201
(38000, 46000] 0 0.772118
1 0.227882
(46000, 53000] 0 0.742015
1 0.257985
(53000, 57000] 0 0.720339
1 0.279661
(57000, 61000] 0 0.745763
1 0.254237
(61000, 64000] 0 0.688144
1 0.311856
我只需要salary_percentile和百分比各自的第二個值(其中早期半途而廢列是1) - 我如何正確地做到這一點?
如果我現在想pairplot - 具有在X軸上的工資水桶和y軸的百分比 - 我需要的系列轉變成數據框?或者我可以繪製索引vs var? – sputniza
我覺得不行,你只需要'df.xs(1,level = 1).plot()' – jezrael