Open robmoore opened 1 year ago
Thanks for the encouragement, Rob!
I like your suggestion. As I have been going back over the first chapters that I translated, I have been trying to streamline and consolidate things, e.g. only using pingouin
to calculate stats when possible, rather than a hodgepodge of numpy
and scipy
and statmodels
. Your suggestion fits in with this approach, so I’ll probably add it.
/Ethan
On 28 May 2023, at 23.00, Rob Moore @.***> wrote:
Thanks for your work on translating the book to use Python! I've found it useful.
I wanted to suggest an alternative to the current implementation for calculating "blowouts".
Instead of using numpy's where function, like this:
afl_margins['blowouts'] = np.where(afl_margins['afl.margins'] > 50, True, False) afl_margins.head() you could use a more pandas-like approach and drop np.where like so:
afl_margins['blowouts'] = afl_margins['afl.margins'] > 50 afl_margins.head() — Reply to this email directly, view it on GitHub https://github.com/ethanweed/pythonbook/issues/16, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACKG7GQL5EUZLU2NQWPFRXDXIO4H7ANCNFSM6AAAAAAYSCCMVY. You are receiving this because you are subscribed to this thread.
Thanks for your work on translating the book to use Python! I've found it useful.
I wanted to suggest an alternative to the current implementation for calculating "blowouts".
Instead of using numpy's
where
function, like this:you could use a pure pandas approach and drop the redundant
np.where
like so:The
where
function is redundant since the evaluation ofafl_margins['afl.margins'] > 50
already returns a Boolean value.