4 ms·
I think I agree. Probably the biggest issue with python. Seemingly random changes between float64 and object happen when doing unit testing(pandas). Can't re
by hospitalJail 3y ago
I think I agree.
Probably the biggest issue with python.
Seemingly random changes between float64 and object happen when doing unit testing(pandas).
Can't remember the exact situation because I switched to While permanently, but there was some For loop problem. If the data came in as length 1, the for loop would read the individual chars of the string. If it came in as >1 it would iterate through the list.
15 years ago when I started python, maybe it made sense. Probably ~5-6 'oof that was a bug I wasted time' in 3 years professional use. Today, I find myself forcing types to solve a bug, or at a minimum checking the types as the program progresses.
- nathan_compton 3y agoPandas is a particularly absurd library.
- falcor84 3y agoPandas's flexibility is amazing for exploration and prototyping. I'm actually a huge fan of the gradual typing approach, whereby you can start just messing around with stuff in a notebook, and then add the types and the rest of the structure once you are ready to solidify your design.
- dist-epoch 3y ago> Pandas's flexibility What you call flexibility I call non-readability: df.ix[0] df.loc["x"] df.loc["x", :] df.iloc[0] df.x df.x[0] df["x"] df[["x"]] df[df["x"]] df["x", 0] df["x"][0] df[:, 0] # and probably a few more I forgot If you stop working with it for 2 months you forget what each one is doing and when you are supposed to use it.
- falcor84 3y agoI'm not clear what your argument is. Many of your examples are just syntactical sugar which you can very easily ignore, and even prohibit in your linter. Also, note that pandas's datafrimes shine when you focus on column operations, if you're finding yourself accessing individual elements by index often, that's usually a sign that you should switch to a more appropriate data structure.
- dist-epoch 3y ago> I'm not clear what your argument is. That when you look at online examples or other people's code you will find all of these variants used.
- falcor84 3y agoLooking at random people's code online is like staring into the abyss. I sometimes see APL code and find myself running in circles and screaming for a bit before I regain my composure, but I don't think that's reason enough for me to complain about APL's design.
- dist-epoch 3y agoThere are alternatives to Pandas, for example Polars doesn't have this problem. Sure, doing an operation in Polars can be more verbose, but it really does have just a few ways of doing things. Which in the end is actually more productive, since you don't need to always google the syntax.
- reportgunner 3y agoThis is not at all exclusive to pandas.
- nathan_compton 3y agoPandas is a shit show compared to dplyr in R and even compared to polars.
- ledauphin 3y agoyeah, this isn't Python, this is pandas. Run far away from pandas if it's not too late.
- dist-epoch 3y ago> If the data came in as length 1, the for loop would read the individual chars of the string. If it came in as >1 it would iterate through the list. You probably did this: for name in ("John"): # "J" # "o" # "h" # "n" for name in ("John", "Sam"): # "John" # "Sam" The correct form for the first one is this: for name in ("John",): # "John"
- reportgunner 3y agoI don't understand how someone can use pandas if they have a choice to use something else. It almost feels like a language of it's own.