Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to sort csv file with datetime

import pandas as pd

df = pd.read_csv('csv.csv', index_col=False)
df['Date'] = pd.to_datetime(df['Date']).dt.strftime('%d/%m/%Y')
df.sort_values('Date', inplace=True)
df.to_csv('result.csv', index=False)
 
PREVIOUS NEXT
Tagged: #sort #csv #file #datetime
ADD COMMENT
Topic
Name
7+2 =