pandas.DataFrame.ndim() Function with example in python
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