Reputation: 3
I have a bunch of csv files, I am reading them using pandas from python. I want to use a combination of map & lambda functions to do this.
I have tried this,
NN=pd.read_csv(filename[0].split('\n')[0])
map((lambda x: NN.append(pd.read_csv(x.split('\n')[0]))), filename)
the map function does not append to NN.
Thanks for your help.
Upvotes: 0
Views: 94
Reputation: 20507
Have you tried using concat
and a generator expression instead:
NN = pd.concat((pd.read_csv(f.split('\n')[0]) for f in filename))
Upvotes: 1