0

I am reading stuff from a postgresql database.

query='SELECT * FROM a_table'
conn = psycopg2.connect(*args,**kwargs)
df=pd.read_sql(query,con=conn)

I get day is out of range for month

I have tried, the following that in my understanding would disable date parsing. However, I still get same error... How to run the query and deal with date errors in python-script space?

  df=pd.read_sql(query,con=conn,parse_dates=[])
4
  • And you really expect an answer with this lack of information. At a minimum the following needs to be added to question 1) The data type of the 'date' column 2) What is returned by show datestyle ; in the command line client psql 3) An example of the data returned by select date_col from a_table in psql? Commented May 17, 2022 at 15:01
  • Hi Adrian. I will try to collect the information you request. Regarding 2: where should I run 'show datestyle ;'? Commented May 17, 2022 at 15:12
  • 1
    As mentioned in psql. Commented May 17, 2022 at 15:14
  • 1
    If you find what I think you will, search for dayfirst here read_sql. Commented May 17, 2022 at 15:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.