What does .shape[] do in “for i in range(Y.shape[0])”?

前端 未结 6 779
攒了一身酷
攒了一身酷 2020-12-22 18:01

I\'m trying to break down a program line by line. Y is a matrix of data but I can\'t find any concrete data on what .shape[0] does exactly.

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-22 18:32

    In Python shape() is use in pandas to give number of row/column:

    Number of rows is given by:

    train = pd.read_csv('fine_name') //load the data
    train.shape[0]
    

    Number of columns is given by

    train.shape[1]
    

提交回复
热议问题