# Write a Python code to concatenate two Pandas series into a single series without repeating the index

PythonPandasServer Side ProgrammingProgramming

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### Practical Machine Learning using Python

Best Seller

91 Lectures 23.5 hours

#### Practical Data Science using Python

22 Lectures 6 hours

Input − Assume, you have a series and the result to concat the values without repeating the index is,

0    1
1    2
2    3
3    4
4    5
5    6

## Solution

To solve this, we will follow these two steps −

• Define two Series

• Concat two series and apply ignore_index value as True to find the result. It is defined below,

pd.concat([series_one,series_two],ignore_index=True)

### Example

Let us see the complete implementation to get a better understanding −

import pandas as pd
series_one = pd.Series([1,2,3])
series_two = pd.Series([4,5,6])
print(pd.concat([series_one,series_two],ignore_index=True))

### Output

0    1
1    2
2    3
3    4
4    5
5    6