pd.cutしたDataFrameをto_sqlするときに以下のエラーが起きて悩んだのでメモ
sqlite3.InterfaceError: Error binding parameter 3 - probably unsupported type.
👇astype(object)はエラー🤮
df['interval'] = pd.cut(df['x'], 3)
df['interval'] = df['interval'].astype(object)
df['interval'] = df['interval'].str.replace(', ', '~')
TypeError: Object of type 'Interval' is not JSON serializable
👇astype(str)はいける🙆♂️
df['interval'] = pd.cut(df['x'], 3)
df['interval'] = df['interval'].astype(str)
df['interval'] = df['interval'].str.replace(', ', '~')
無事書き出せました。