Skip to content
Advertisement

Splitting a dataframe with many labels

I’m trying to split my data by different labels, like this:

JavaScript

And this works fine for small amounts of numbers. However, I want to do this for many values. for example:

JavaScript

This spits outs an error:

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

I’ve read the other questions with this error, but I am already using bitwise operators, they don’t address many conditions from what I understand.

How do I split the dataframe based on what’s in the tuple/list/etc?

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement