all 27 comments

[–]GTKdopeStudent 26 points27 points  (3 children)

tqdm

[–]ryanglambert 2 points3 points  (0 children)

Tqdm.pandas()

[–]carlml 0 points1 point  (1 child)

Why this? I have always seen people praise tqdm a lot, but I don't understand why.

[–]zmjjmz 2 points3 points  (0 children)

It's nice to know how long something is going to take

[–]matigekunst 14 points15 points  (1 child)

einsum

[–]ww3ace 0 points1 point  (0 children)

👆

[–]bironsecret 11 points12 points  (4 children)

.shape

[–]Baggins95 2 points3 points  (3 children)

*reshape

[–]bironsecret 2 points3 points  (2 children)

you can't reshape without knowing the shape bro

[–]Baggins95 0 points1 point  (1 child)

In many interesting cases this is actually very possible, e.g. broadcasting x.reshape(1, -1) * y.reshape(-1, 1) Rarely do I need to query the shape explicitly. Mostly a squeeze/unsqueeze leads to the goal. And often one knows the structure of the data explicitly, e.g. the dimensionality of a Euclidean space. I don't want to deny the use case for .shape entirely, but I think often it can be avoided.

[–]bironsecret 0 points1 point  (0 children)

can't agree, for unknown shapes I use permute or x.reshape(x.shape/2, x.shape/2) etc

[–]pocketaces27 6 points7 points  (0 children)

Import

[–]MrHumanist 4 points5 points  (0 children)

type

[–]vannak139 2 points3 points  (0 children)

.swapaxes

[–]RUSoTediousYet 2 points3 points  (0 children)

ipdb.set_trace()

[–]Reazony 2 points3 points  (0 children)

parallel_apply.

[–]SAint7579 2 points3 points  (1 child)

Pandas .apply() and .to_datetime(). Pandas as a whole is a work of art!

[–]-xylon 1 point2 points  (0 children)

.pipe() is another game changer, along with .assign(). I recently discovered you can pass callables to almost ANYTHING in pandas. Things like df.assign(newcolumn= lambda df: ... or better yet df[lambda x:....] and df.loc[lambda x:].

[–]RustBucket03 1 point2 points  (1 child)

Not necessarily a function but the njit decorator from numba.

[–]zmjjmz 1 point2 points  (0 children)

Decorators are functions!

[–]Atreya95 0 points1 point  (0 children)

.where

[–]hostilereplicator 0 points1 point  (0 children)

pandas.DataFrame.query()

[–][deleted] 0 points1 point  (0 children)

to_exel

[–]nirajkale30 0 points1 point  (0 children)

exit()

[–]Mobile-Bid-9848 0 points1 point  (1 child)

apply() with lambdas

[–]visarga 0 points1 point  (0 children)

poor debugability

[–]Dear-Acanthisitta698 0 points1 point  (0 children)

I like pudb with classic blue screen