I am new to python and Iam trying to manipulate some data but it keeps showing me this erro message
UserWarning: Parsing '13/01/2021' in DD/MM/YYYY format. Provide format or specify infer_datetime_format=True for consistent parsing.
cache_array = _maybe_cache(arg, format, cache, convert_listlike)
This is my code
import pandas as pd
import matplotlib.pyplot as plt
dataLake = pd.read_csv("datalake - Data lake.csv", parse_dates=["Day"])
dataLake = dataLake.rename(columns={"Day":"day"})
dataLake = dataLake.rename(columns={"Agent":"agent"})
dataLake["day"] = pd.to_datetime(dataLake.day)
print(dataLake.head())
CodePudding user response:
In your case you need to set the dayfirst param to true, like this:
pd.to_datetime(dataLake.day, dayfirst=true)
or you can set a format (but you don't need to in your case), like this:
pd.to_datetime(dataLake.day, format="%d/%m/%y")
CodePudding user response:
Could you add a link on your dataset?
