df.shape #we check the shape of dataset
(1338, 7)
While calling the above shape function, we did not use () but for most of the other function we use (). why is that?
df.info()# gives the info of the dataset
df.shape #we check the shape of dataset
(1338, 7)
While calling the above shape function, we did not use () but for most of the other function we use (). why is that?
df.info()# gives the info of the dataset
pandas.DataFrame.shape
is not a function, it's a property, as you can see here in the definition of shape
:
@property
def shape(self) -> Tuple[int, int]:
...
A property is accessed (read and written) just as if it were a regular attribute of the object, so no parentheses are used.