Append two Pandas Series

In this lesson, we will append two Pandas series using the append() method. This will append two series. With that, the ignore_index parameter of the append() will allow you to ignore or consider the index. If ignore_index is set to True, the original indexes are ignored and replaced by 0, 1, 2, etc. in the output. The default is False.

Note: The append() method deprecated since version Pandas 1.4.0.

We will see two examples:

  1. Append two Pandas series considering the original index
  2. Append two Pandas series ignoring the original index

Append two Pandas series considering the original index

To append two series, use the append() method. The ignore_index parameter is by default set to False. This will keep both series indexes alive even after the append. Let us see an example:

Output

Append two Pandas series ignoring the original index

To append two series, use the append() method. For ignoring the original indexes and replacing them with 0, 1, 2, etc, set the ignore_index to True as discussed above.

Let us see an example:

Output


If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.


For Videos, Join Our YouTube Channel: Join Now


 

Concatenate Pandas DataFrames
Combine two Pandas series into one
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading