pandas.DataFrame.ndim — pandas 3.0.0rc0+52.gb43b95d2b4 documentation (original) (raw)
- API reference
- DataFrame
- pandas.DataFrame.ndim
property DataFrame.ndim[source]#
Return an int representing the number of axes / array dimensions.
Return 1 if Series. Otherwise return 2 if DataFrame.
See also
Number of array dimensions.
Examples
s = pd.Series({"a": 1, "b": 2, "c": 3}) s.ndim 1
df = pd.DataFrame({"col1": [1, 2], "col2": [3, 4]}) df.ndim 2