
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How to append elements to a Pandas series?
In this program, we will append elements to a Pandas series. We will use the append() function for this task. Please note that we can only append a series or list/tuple of series to the existing series.
Algorithm
Step1: Define a Pandas series, s1. Step 2: Define another series, s2. Step 3: Append s2 to s1. Step 4: Print the final appended series.
Example Code
import pandas as pd s1 = pd.Series([10,20,30,40,50]) s2 = pd.Series([11,22,33,44,55]) print("S1:\n",s1) print("\nS2:\n",s2) appended_series = s1.append(s2) print("\nFinal Series after appending:\n",appended_series)
Output
S1: 0 10 1 20 2 30 3 40 4 50 dtype: int64 S2: 0 11 1 22 2 33 3 44 4 55 dtype: int64 Final Series after appending: 0 10 1 20 2 30 3 40 4 50 0 11 1 22 2 33 3 44 4 55 dtype: int64
- Related Articles
- How to append a pandas Series object to another Series in Python?
- How to append a list to a Pandas DataFrame using append() in Python?
- Write a program to append Magic Numbers from 1 to 100 in a Pandas series
- How to access Pandas Series elements by using indexing?
- How to access datetime indexed elements in pandas series?
- Python Pandas - How to append rows to a DataFrame
- How to remove a group of elements from a pandas series object?
- How to access pandas Series elements using the .iloc attribute?
- How to access pandas Series elements using the .loc attribute?
- How to count the valid elements from a series object in Pandas?
- Accessing elements of a Pandas Series
- How to append two DataFrames in Pandas?
- How to sort a Pandas Series?
- How to append elements to a dictionary in Swift?
- How to compare elements of a series by Python list using pandas series.ge() function?

Advertisements