pandasソリューションの恩恵を受けるrで尋ねられたデータフレームに別のgreat questionがあります。ここに質問があります。パンダのグループ化とカウントダウン
は私が
country
ごとstatus
がopen
する回数とstatus
がclosed
する回数をカウントします。次にcloserate
をcountry
と計算します。データ:
customer country closeday status 1 1 BE 2017-08-23 closed 2 2 NL 2017-08-05 open 3 3 NL 2017-08-22 closed 4 4 NL 2017-08-26 closed 5 5 BE 2017-08-25 closed 6 6 NL 2017-08-13 open 7 7 BE 2017-08-30 closed 8 8 BE 2017-08-05 open 9 9 NL 2017-08-23 closed
アイデアは
open
とclosed
状態の数、およびclose_ratio
を描いた出力を得ることです。これは望ましい出力です:country closed open closed_ratio BE 3 1 0.75 NL 3 2 0.60
お待ちしております。
解決策は以下のとおりです。他のソリューションへようこそ。