I am concatenating a few dataframes together, however rather than rows just being appended into one large dataframe, they appear to be getting 'smushed' together. For example:
df1 = a | b
1 | 2
2 | 3
3 | 4
df2 = a | b
5 | 6
7 | 8
df3 = pd.concat([df1, df2])
for index, row in df3.iterrows():
print(df3.at[index, 'a'])
# expected output:
# 1
# 2
# 3
# 5
# 7
# actual output:
# series containing [1, 5]
# series containing [2, 7]
# 3
...
If I export to csv, the data appears as expected, with one value per cell per row. But if I try to search for 1 in column 'a' in df3, it cannot find it because it is in a list instead of its own value in the cell. I have a workaround for this, but why is this happening in the first place?
A few things to note:
- I have other projects where I do concats and they behave as expected, so it seems to have to do with the environment I'm working in.
- I am on pandas 2.2.3
df3 = pd.concat([df1, df2], ignore_index=True)dfindf.at[index, 'a']?