kind of new to pandas.
I have
df1 = pd.Dataframe(
[
{'a': 1},
{'a': 2},
{'a': 3},
]
)
df2 = pd.Dataframe(
[
{'a': 4},
{'a': 5},
]
)
I want
df_id a
1 1
2
3
2 4
5
Assume I have a list of dfs like df1
and df2
. What is the correct way to get the result df?
Am I supposed to also declare some column as a key? or a primary key? Notice that I want to retain the option to slice this dataframe by df_id
to get back the original dfs.
Also, what is this operation called? I didn't even know what to search for.