Dataframe to postgresql - Saving the dataframe to memory using StringIO

Marco Sulla Marco.Sulla.Python at gmail.com
Thu Oct 22 06:33:39 EDT 2020


Try to save it in a binary field on PG using hdf5:

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_hdf.html

On Thu, 22 Oct 2020 at 11:29, Shaozhong SHI <shishaozhong at gmail.com> wrote:

> I found this last option is very interesting.
>
> Saving the dataframe to memory using StringIO
>
> https://naysan.ca/2020/06/21/pandas-to-postgresql-using-psycopg2-copy_from/
>
> But, testing shows
> unicode argument expected, got 'str'
>
> Any working example for getting DataFrame into a PostgreSQL table directly?
>
> Regards,
>
> David
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list