Home > Software engineering >  Trying to clean up a text file
Trying to clean up a text file

Time:02-10

I need to import a text file that is formatted as such

(202002, 88), (201501, 88)
(202004, 76), (201602, 35)
(201012, 113), (201012, 115)
(201009, 114), (201708, 114)
(201603, 31), (201206, 78)

And turn it into a dataframe with this format where the first column is a date and the second column is an integer for temperature.

Year Temp
201803 95
201708 61
202002 88
201501 88
202004 76
201602 35
201012 113
201012 115
201009 114
201708 114
201603 31
201206 78

I tried to import it using pandas_csv but I get a dataframe with 4 columns and 2 rows of data in row.

           0      1         2      3
0    (201803    95)   (201708    61)
1    (202002    88)   (201501    88

CodePudding user response:

  •  Tags:  
  • Related