I have two pandas dataframes. The first one contains 3401 row 1 column, the second one is 4 row with 3 column.
But what I got is (exemple output of my script):
DataFrame1 | DataFrame2
- email1 | -Id1 -Project1 -Descr1
- email2 | -Id2 -Project2 -Descr2
- email3 | -Id3 -Project3 -Descr3
- email4 | -Id4 -Project4 -Descr4
- email5 | -None -None -None
... .... | ... ...
- email3401 | -None -None -None
What I want to do is for every mail, I want to get something like that :
- mail1, Id1, Project1, Descr1, Id2, Project2, ... , Id4, Project4, Descr4
- mail2, Id1, Project1, Descr1, Id2, Project2, ... , Id4, Project4, Descr4
... ...
- mail3401, Id1, Project1, Descr1, Id2, Project2, ... , Id4, Project4, Descr4
Thanks for Advices !
Here is my code :
path = r"/Users/kd/path"
allFiles = glob.glob(path + "/*.csv")
frame = pd.DataFrame()
file_names = []
j=0
for file_ in allFiles:
name = os.path.splitext(file_)[0]
i = int(name[-1])
file_names.append(name)
df = pd.read_csv(file_, index_col = None, header = 0)
if j>0:
globals()["self.dfInternautes%s"%i] = pd.concat([globals(["self.dfInternautes%s"%i], df], axis=1)
else:
globals()["self.dfInternautes%s"%i] = df
j += 1
Id1, Project1, Descr1, Id2, Project2, ... , Id4, Project4, Descr4) except for the first column (mail1, mail2, ...)?