The Pandas Series property values used to retrieve the Series as ndarray or ndarray-like depending on the dtype.
1 import pandas as pd
2
3 df = pd.Series(['a', 'b', 1, 12])
4
5 res = df.values
6 print('The Series property values :')
7 print(res)
In the above example, a Series object is created by passing an array. A values property is accessed that returns the values that will be assigned to the variable that will be printed on console.
1 The Series property values :
2 ['a' 'b' 1 12]
Series with number
1 import pandas as pd
2
3 df = pd.Series([1, 2, 3, 4])
4
5 res = df.values
6 print('The Series property values :')
7 print(res)
In the above example, a Series object is created by passing an array of number. A values property is accessed that returns the values that will be assigned to the variable that will be print.
1 The Series property values :
2 [1 2 3 4]
Series with string
1 import pandas as pd
2
3 df = pd.Series(['welcome', 'to', 'IOGyan'])
4
5 res = df.values
6 print('The Series property values :')
7 print(res)
In the above example, a Series object is created by passing an array of string literals. A values property is accessed that returns the values that will be assigned to the variable that will be print.
1 The Series property values :
2 ['welcome' 'to' 'IOGyan']
Related options for your search