Dear Python experts, I never figured out when to call a method with parenthesis, when is it not? It seems inconsistent.
For example, If I do > data.isnull() numberair_pressure_9amair_temp_9amavg_wind_direction_9amavg_wind_speed_9am max_wind_direction_9ammax_wind_speed_9amrain_accumulation_9am rain_duration_9amrelative_humidity_9amrelative_humidity_3pm 0 False False False False False False False False False False False 1 False False False False False False False False False False False 2 False False False False False False False False False False False Or I can do without parenthesis, > data.isnull <bound method DataFrame.isnull of number air_pressure_9am air_temp_9am avg_wind_direction_9am \ 0 0 918.060000 74.822000 271.100000 1 1 917.347688 71.403843 101.935179 2 2 923.040000 60.638000 51.000000 Obviously, the second case does not make any senses. But, in data.columns, it is only correct to do without parenthesis as below: > data.columns Index(['number', 'air_pressure_9am', 'air_temp_9am', 'avg_wind_direction_9am', 'avg_wind_speed_9am', 'max_wind_direction_9am', 'max_wind_speed_9am', 'rain_accumulation_9am', 'rain_duration_9am', 'relative_humidity_9am', 'relative_humidity_3pm'], dtype='object') # with parenthesis throws an error > data.columns() ---------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-16-05cf52d0a56e> in <module>()----> 1 data.columns() TypeError: 'Index' object is not callable I always thought columns(), isnull() are methods to objects, so, you would need to pass parameters even when it's empty. But, apparently I am wrong on this. What is going on? Thank you very much! _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor