Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How the concat function in pandas implements the specified index

Shulou Source: shulou.com Published: 2022-05-31 13:49:23 09月24日 Update

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!

Tags: Articles indexes functions names values interests at the same time more friends knowledge editing industry information information channels channels references learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info macOS Apple Microsoft Shulou Technology