Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Function Outputs None instead of Return

Current License: CC BY-SA 4.0

Post Revisions

6 events
when toggle format what by license comment
Jul 15, 2020 at 17:15 vote accept Community Bot
Jul 12, 2020 at 13:56 comment added FaCoffee I'll chip in with some explanation as to why you were getting None. When you use the return call, you have to specify what you want to be returned on the same line as return. In your example, you had return and then your desired outcome was specified in a new line. This made Python think that you did not want anything to be returned, hence None. Hope it helps.
Jul 12, 2020 at 13:54 comment added azro Also you can inline it return person[person.state==state].copy(deep=True).weight.sum()
Jul 12, 2020 at 13:54 comment added mama you need returnvalue on the same line :)
Jul 12, 2020 at 13:53 answer added Aleksander Ikleiw timeline score: 2
Jul 12, 2020 at 13:53 history asked user13747020 CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /