KOTA ITO

Generation

generate functionWed, 07 Dec 2022

データフレームの文字列の文字列を置換する

def replace_str(df, colname, before, after): df[colname] = df[colname].astype(str).str.replace(before, after) return df replace_str(df, 'txt', '-', ' ')

Questions about programming?Chat with your personal AI assistant