Answer the question
In order to leave comments, you need to log in
How can pandas data encoding problems be fixed when writing to Postgresql?
I download OKATO data from this resource https://rosstat.gov.ru/opendata/7708234640-okato .
File encoding - windows-1251
Next, I create a Dataframe and write to the PostgreSQL database:
import pandas as pd
df = pd.read_csv(target_link, encoding="windows-1251", delimiter=";")
df..to_sql(...)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question