Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. import pandas as pd
  2. import glob
  3.  
  4. # the only thing that you need to do is to change the name of the folder
  5. path ='/home/nov/PycharmProjects/convert'
  6. allFiles = glob.glob(path + "/*.csv")
  7. frame = pd.DataFrame()
  8. list_ = []
  9. for file_ in allFiles:
  10. df = pd.read_csv(file_, index_col=None, header=0)
  11. row = 0
  12. for i in df['Date']:
  13. temp = pd.to_datetime(i)
  14. temp = temp.strftime("%d/%m/%Y %H:%M")
  15. df.set_value(row, 'Date', temp)
  16. print(df['Date'][row])
  17. row += 1
  18.  
  19. df.to_csv(file_, index=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement