import pandas as pd # Creating two Series objects series1 = pd.Series([10, 20, 30]) series2 = pd.Series([40, 50, 60]) # Appending series2 to series1 new_series = series1.append(series2) print(new_series)
import pandas as pd # Creating a Series object series1 = pd.Series([10, 20, 30]) # Appending a scalar value to series1 new_series = series1.append(pd.Series(40)) print(new_series)In this example, we have created a Series object named series1. We then used the append method to add a scalar value (40) to the end of series1. The output of the code is a new Series object that contains all the elements of series1 and the new scalar value. The package library being used in these examples is pandas (imported as "pd").