Ernest Bonat, Ph.D.
1 min readJan 30, 2020

--

hi eoghan,

why do we need to loop?

{cls: round(float(mayority)/float(count), 2) for cls, count in counter.items()}[1])

we get the same result with two lines of code:

y_counts = y.value_counts()

max(y_counts)/min(y_counts)

looping is a bad programming practice, at least is very necessary. am i right?

--

--

Ernest Bonat, Ph.D.
Ernest Bonat, Ph.D.

Written by Ernest Bonat, Ph.D.

I’m a Senior Machine Learnig Developer. I work on Machine Learning application projects for Life Sciences using Python and Python Data Ecosystem.

Responses (1)