Comments

You must log in or register to comment.

SAint7579 t1_itvint1 wrote

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

3

RustBucket03 t1_itvqgii wrote

Not necessarily a function but the njit decorator from numba.

2

Baggins95 t1_itvy1g6 wrote

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.

1

-xylon t1_itycq7h wrote

.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:].

2

BrianP21 t1_itz5qcx wrote

Import pytorch_lightning as pl

1