I have looked at many solutions for this but cannot find one that works for what I want to do.
Basically I have 2 CSV files:
all.csv
1 Wed Oct 03 41.51093923 41.51093923 41.51093923 41.51093923
2 Wed Oct 04
3 Wed Oct 05 41.43764015 41.43764015 41.43764015
4 Wed Oct 06 41.21395681 41.21395681 41.21395681
5 Wed Oct 07 42.07607442 42.07607442 42.07607442
6 Wed Oct 08 42.0074109 42.0074109 42.0074109
7 Wed Oct 09 41.21395681 41.21395681
8 Wed Oct 10 41.43764015 41.43764015 41.43764015 41.43764015
9 Wed Oct 11 41.21395681 41.21395681 41.21395681 41.21395681
original.csv
10 Wed Oct 12 41.43764015
11 Wed Oct 13
12 Wed Oct 14 42.07607442 42.07607442 42.07607442
13 Wed Oct 15 41.43764015 41.43764015 41.43764015 41.43764015
14 Wed Oct 16 41.21395681 41.21395681 41.21395681 41.21395681
15 Wed Oct 17
16 Wed Oct 18 42.07607442 42.07607442 42.07607442
I want to append original.csv
to all.csv
, by simply taking all rows in original.csv
and merging them underneath the last line in all.csv
to get:
1 Wed Oct 03 41.51093923 41.51093923 41.51093923 41.51093923
2 Wed Oct 04
3 Wed Oct 05 41.43764015 41.43764015 41.43764015
4 Wed Oct 06 41.21395681 41.21395681 41.21395681
5 Wed Oct 07 42.07607442 42.07607442 42.07607442
6 Wed Oct 08 42.0074109 42.0074109 42.0074109
7 Wed Oct 09 41.21395681 41.21395681
8 Wed Oct 10 41.43764015 41.43764015 41.43764015 41.43764015
9 Wed Oct 11 41.21395681 41.21395681 41.21395681 41.21395681
10 Wed Oct 12 41.43764015
11 Wed Oct 13
12 Wed Oct 14 42.07607442 42.07607442 42.07607442
13 Wed Oct 15 41.43764015 41.43764015 41.43764015 41.43764015
14 Wed Oct 16 41.21395681 41.21395681 41.21395681 41.21395681
15 Wed Oct 17
16 Wed Oct 18 42.07607442 42.07607442 42.07607442
As you can see there is no headers for the data and the rows vary in length. This is just an example of the type of files I am working with but I want to get a solution that can work on any CSV.
I am working with Python3 and so far have tried using the pandas
library but had no luck.
Any suggestions would be great, thanks.