I have a list "profiles" looking like this for each element of the list: enter image description here
I want to create a dataframe out of this list, so that every account is in the dataframe. When I create one dataframe for every element of the list manually and then append them all to one dataframe it works. However, I wanted to do a loop because I have about 40 elements in that list.
The code looks as follows (doing it manually):
df2 = pd.DataFrame(profiles[1])
df1 = df1.append(df2)
df3 = pd.DataFrame(profiles[2])
df1 = df1.append(df3)
... and so on
My loop looks like this:
for y in range(len(profiles)):
if x != y:
df1 = pd.DataFrame(profiles[x])
df2 = pd.DataFrame(profiles[y])
df1.append(df2)
Does anybody know how to make the loop work? Because it does not append the second dataframe.
df.appendis deprecated from version 1.4.0, so it's better to usedf.concatenate. Also, if possible, please add a data sample for us to try out and your exptected output. Thank you.