Reputation: 27
I have a question on importing multiple csv files such that they are vertically stacked into a column array.
[Here is a a sample; all the files look the same]:
yyyymm count_neg count_pos count_all score
200301 114 67 7470 0.006291834
200303 106 51 3643 0.015097447
200305 102 62 3925 0.010191083
200306 129 71 4964 0.011684126
200308 53 50 3819 0.000785546
200309 59 58 3926 0.000254712
200310 50 63 3734 -0.003481521
200312 75 55 4256 0.004699248
This particular set of data is from a excel sheet called 2003.csv I also have similar file names for years 2004, 2005, 2006
So again I am wondering how to get these into python such that: I vertically stack these csv into a column array
Right now, all I know how to do is this:
yr2003 = pandas.read_csv('2003.csv', header=0,parse_dates=True)
While df = pd.concat([yr2003, yr2004, yr2005]) does indeed combine things, I am only looking to combine yyyymm and count_all score columns.
Upvotes: 1
Views: 58