dfの特定列の特定文字を使用して行を分割する方法 2023年2月1日 / 1 min read View more blogs with the tag pandas , View more blogs with the tag python Table of Contents #はじめに #方法 #参考 はじめに これを 郵便番号町域名11111111甲、乙 こうしたいときの方法です。 郵便番号町域名11111111甲11111111乙 方法 # '、'で分割。df.assign(町域名=df['町域名'].str.split('、').explode('町域名') # 分割後も'、'を残したいときは、'.'を追加してそこで区切る。df.assign(町域名=df['町域名'].str.split(r'(?<=。)(?=.)')).explode('町域名') 参考 DataFrame の 1 行を複数行に分ける方法について教えてください。