I have a CSV file which has date value like "20181029". Note that this column can have blank values as well. I want to convert this column as date - data type like (2018-10-29), for blank columns i want to have blank value in dataframe.
Call the read_csv method with the argument parse_dates. The value of this argument should be the name of the column in your csv file that contains the dates:
df = pd.read_csv('myfile.csv', parse_dates=['some_col'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With