Hacker News new | ask | show | jobs
by mint2 848 days ago
Well does the R df$colname behave like panda df.colname or is it like df[“colname”] which opens up a whole new layer where it can be df[var]?

And there’s a ton of helpful things like dict unpacking of named aggs for groups bys. The dictionary can be the result of code or it can be spelled out.

Also, a side note, both pandas and R make it easy to chain or pipe a long series of ops. I try to keep the number down though. In other languages this can be frowned on as a hard to debug train wreck pattern, esp if it grows to long. Usually I define filters and functions outside the train and pass them in rather inline the filters or lambdas as they’re so much easier to debug that way.

1 comments

You can also debug by putting each method on a separate line, which allows for debugging by commenting out individual methods one at a time. It enhances readability too. Example: (df.method1()

      .method2()

      .method3()
)
The code didn’t render properly, and it’s not letting me edit the comment. Here’s my example: (df.method1()

     .method2()

     .method3()

)