Pandas Series property values in Python
The Pandas Series property values used to retrieve the Series as ndarray or ndarray-like depending on the dtype.
Syntax
 1 Series.values
values property
 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.
Output
 1 The Series property values :
 2 ['a' 'b' 1 12]

Series with number

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.
Output
 1 The Series property values :
 2 [1 2 3 4]

Series with string

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.
Output
 1 The Series property values :
 2 ['welcome' 'to' 'IOGyan']
Privacy Policy
Terms of Service
Disclaimer
Contact us
About us