1
I need to generate a new dataframe with the concatenation of two dataframes. The following code works, but it takes a long time to run.
df_concatena = pd.DataFrame()
for x in range(len(df)):
for y in range(len(data)):
df_concatena = df_concatena.append(pd.concat([df.iloc[x], data.iloc[y]]), ignore_index=True)
I tried to use apply but was unsuccessful.
Example df: df.Shape -> 81476
'Valor','Clase','Tempo'
44.99 , 'A' , 5
61.49 , 'B' , 8
102.24 , 'C' , 6
51.07 , 'B' , 8
32.78 , 'B' , 12
30.05 , 'B' , 10
Example date: date.Shape -> 21
'Dia_Semana','Faixa'
0 , 'A'
0 , 'B'
0 , 'C'
1 , 'A'
1 , 'B'
1 , 'C'
For each df row, I need to add all 21 date lines.
Can you give us an example of how they are
df
anddata
?– jfaccioni
Good tad, @N.Peterson. If your goal is just to concatenate pandas dataframes, I suggest the module’s "Concat" function. The documentation is here: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.concat.html
– Anderson Chaves