str.split(~,expand=True)[*]で置換後に取得

投稿者: | 2022-06-11

列「Country」の[note 9]を除外したい場合

test
test['Country'].str.split('[', expand=True)

# expand=Trueで分割した文字列をDataFrameに展開できる(下図)
test['Country'] = test['Country'].str.split('[', expand=True)[0]
test