Live data from Hacker News

Method Chaining in Pandas: Bad Form or a Recipe for Success?

davidamos.dev

11–15 of 15 posts

Re: Method Chaining in Pandas: Bad Form or a Recipe for Success?

#11
Random lists of strings are hard to decipher. What is that set of values supposed to represent? And it interrupts the flow of figuring out what’s going on.

I prefer assigning lists like that to informatively name variable rather than have leave them the subject of speculation. It’s easier yo add add clarifying comments that way too.

In sql or pandas, long lists of values not broken up are hard to read. It’s easy to scan down a single value on each row, not random length values spread randomly across the screen.

Also That is chaining far too much in a single go

Re: Method Chaining in Pandas: Bad Form or a Recipe for Success?

#12
post #8

Earlier quoted context omitted.

I find Pandas vs. SQL to be complimentary, rather than an either-or type situation. For anything in the tens of GB range or smaller, it’s easy enough to move between the two with read_sql_query and to_sql. The general strategy is to build the core of any dataset as a SQL query that handles joins and performance-sensitive parts of the query, then polish/plot/yeet into weird shapes with Pandas since it offers much grea…

What bugs me about pandas is that it is so copy heavy. I just wanted to know if there was some pythonic way to get performance without just writing normal SQL

Any specific examples you have in mind?

Re: Method Chaining in Pandas: Bad Form or a Recipe for Success?

#13
post #10

I had a whole rant queued up on "Pandas and its consequences have been a disaster for the human race" (well, at least for newbie programmers), but I think instead I want to focus on the damn dictionary splats. I just don't get it - it's pure "clever" code in the pejorative Dijkstra sense. It's hard to edit, it's hard to typecheck. Why not pay the very low whitespace tax to give each key/value pair its own longhand li…

I’m on the same page with formatting, it’s not a pandas thing. (Doesn’t actually look like you’re saying it’s only a pandas thing) The same formatting patterns happen in all languages I’ve seen, sql quite often.

It’s just a bad programming habit thing.

Post reply on HN