How the concat function in pandas implements the specified index
This article mainly introduces the pandas concat function how to achieve the specified index, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Specify index
In [17]: pd.concat ([df1, df3], keys= ['df1','df3']) Out [17]: letter number animaldf1 0 a 1 NaN 1 b 2 NaNdf3 0 c 3 cat 1 d 4 dogIn [18]: pd.concat ([df1, df3], keys= [' df1','df3'], names= ['df name' 'OK ID']) Out [18]: letter number animaldf name line ID df1 0 a 1 NaN 1 b 2 NaNdf3 0 c 3 cat 1 d 4 dog thank you for reading this article carefully I hope the article "how to achieve the specified index of concat function in pandas" shared by the editor is helpful to everyone. At the same time, I also hope that you can support it and pay attention to the industry information channel. More related knowledge is waiting for you to learn!