Tag: How To Get The Dimension Of A DataFrame?


  • How To Get The Dimension Of A DataFrame?

    How To Get The Dimension Of A DataFrame?

    How To Get The Dimension Of A DataFrame? Table Of Contents: Syntax To Print Dimension Of Data Frame. Examples Of Printing Dimension. (1) Syntax: property DataFrame.ndim Description: Return an int representing the number of axes / array dimensions. Return 1 if Series. Otherwise return 2 if DataFrame. (2) Examples Of Columns : Example-1 s = pd.Series({‘a’: 1, ‘b’: 2, ‘c’: 3}) s.ndim Output: 1 Example-2 df = pd.DataFrame({‘col1’: [1, 2], ‘col2’: [3, 4]}) df Output: df.ndim Output: 2

    Read More