Program to add some data to an existing series

In this python pandas program, we will add some data to an existing series using pandas library.

Steps to solve the program
  1. Import pandas library as pd.
  2. Create a series using pd.Series().
  3. Now add some data to the series using df.append(pd.Series([data])).
  4. Print the output.
				
					import pandas as pd
df = pd.Series([54,27.9,'sqa',33.33,'tools'])
print("Original Data Series:")
print(df)
print("Data Series after adding some data:")
new = df.append(pd.Series(['python',100]))
print(new)
				
			

Output :

				
					Original Data Series:
0       54
1     27.9
2      sqa
3    33.33
4    tools
dtype: object
Data Series after adding some data:
0        54
1      27.9
2       sqa
3     33.33
4     tools
0    python
1       100
dtype: object
				
			

sort a given Series

create a subset of a given series based on value and condition

Leave a Comment