Pandas ndim attribute returns the number of dimensions of the Series, it is 1 in general.
get_dimensions.py
import pandas as pd
primes = [2, 3, 5]
primes_index = ['first_prime', 'second_prime', 'third_prime']
primes_series = pd.Series(primes, index=primes_index, name='Hold the Prime numbers')
print('primes_series dimensions : ', primes_series.ndim)
Output
primes_series dimensions : 1
Previous Next Home
No comments:
Post a Comment