1

I'm using notebooks and I'm confused.

My original question was why describe is different from describe().

So I read the excellent article Purpose of calling function without brackets python.

But so I keep don't understand why (maybe when?) to use describe, since it looks to return all the dataset...

Naivre
  • 97
  • 7
  • 1
    Your links are to the same strange image. Please include the information as text instead – Stefan Jan 19 '21 at 20:48
  • 3
    `.describe` is the method. `.describe()` calls it. [documentation](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.describe.html). What does the image have to do with anything? – M Z Jan 19 '21 at 20:48
  • Additionally, [this](https://stackoverflow.com/questions/65646020/what-distinguishes-a-command-from-needing-vs-not/65646642#65646642) question may also provide insight into when to use or not use parenthesis. – amquack Jan 19 '21 at 21:06
  • What @MZ is pointing out is that when you include the parenthesis, you call the method. When you fail to include the parenthesis, what returns is information regarding the method. You likely want to include the parenthesis (notice that they are included in all examples in the documentation). – amquack Jan 19 '21 at 21:09
  • Is not `describe`, without parenthesis, a attribute? – Naivre Jan 19 '21 at 22:50
  • @Naivre yes it is. The attribute is the function. – M Z Jan 19 '21 at 23:32
  • @Naivre yes, methods *are* attributes – juanpa.arrivillaga Jan 20 '21 at 16:35
  • The confusing thing here is that the way the method is printed it prints the dataframe it is attached to. In any case, you would use that whenever you want to reference the method e.g. as a callback – juanpa.arrivillaga Jan 20 '21 at 16:35

0 Answers0