Series is a one dimensional pandas data structure which can data of almost any type. It resembles an excel column. It supports multiple operations and is used for single dimensional data operations.
Creating a series from data:
Creating an empty Series :
A basic series, which can be created is an Empty Series.
filter_none
edit
play_arrow
brightness_4
# import pandas as pd
import pandas as pd
# Creating empty series
ser = pd.Series()
print(ser)
Output :
Series([], dtype: float64)
Creating a series from array:
In order to create a series from array, we have to import a numpy module and have to use array() function.
filter_none
edit
play_arrow
brightness_4
# import pandas as pd
import pandas as pd
# import numpy as np
import numpy as np
# simple array
data = np.array(['g', 'e', 'e', 'k', 's'])
ser = pd.Series(data)
print(ser)