-10

I have a bunch of dates from a csv file in this format

1/25/2015 1:51
1/26/2015 11:22
1/26/2015 20:33
1/27/2015 15:29
1/28/2015 19:11
1/28/2015 19:41
1/30/2015 6:20
2/2/2015 16:24
2/4/2015 18:38

Is there an efficient proper way in Python to parse the date and extract the year? 2/8/2015 22:22

CodyBugstein
  • 21,984
  • 61
  • 207
  • 363

2 Answers2

0
time.strptime("2/8/2015 22:22", "%d/%m/%Y %H:%M") 
0

Look at pandas, an open source library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.

In particular, look at pandas.read_csv which allows you to read from a csv file.