I have two CSV files
csv1:
header
a
b
c
csv2:\
header
e
f
g
I want to merge these two files to another CSV in alternate rows like
output.csv:
header
a
e
b
f
c
g
Can this be done? Thanks in advance
>Solution :
Will definitly not be the fastest way but it works
import pandas as pd
from itertools import chain, zip_longest
x = pd.DataFrame()
x["header"] = [1, 3, 5, 7]
y = pd.DataFrame()
y["header"] = [2, 4, 6, 8, 10, 21]
chained = list(chain.from_iterable(zip_longest(x["header"].to_list(), y["header"].to_list())))
df = pd.DataFrame()
df["header"] = chained
df = df.dropna()