Add a Pandas series to another Pandas series
Let us see how to add a Pandas series to another series in Python. This can be done using 2 ways:
Method 1: Using the append() function: It appends one series object at the end of another series object and returns an appended series. The attribute, ignore_index=True is used when we do not use index values on appending, i.e., the resulting index will be 0 to n-1. By default, the value of the ignore_index attribute is False.
Appending two Series without using ignore_index attribute:
Note: If we don’t use ignore_index attribute, then the second series will use its own index upon appending operation.
Method 2: Using the concat() function: It takes a list of series objects that are to be concatenated as an argument and returns a concatenated series along an axis, i.e., if axis=0, it will concatenate row-wise and if axis=1, the resulting Series will be concatenated column-wise.
Concatenating two Series column-wise:
0 2 10
1 4 12
2 6 14
3 8 16
Note: When concatenation done on two Series column-wise, then the result will be a DataFrame.