pandas.DataFrame.ndim() Function with example in python

Spread the love

DataFrame.ndim: This Function return an int representing the number of axes / array dimensions.

Return 1 if Series. Otherwise return 2 if DataFrame.

#example program on DataFrame.ndim() Function

import pandas as pd d = {'exp': [1, 2], 'salary': [10000, 15000]} df = pd.DataFrame(data=d) print(df.ndim)

Output:

2

admin

admin

Leave a Reply

Your email address will not be published. Required fields are marked *