4
It bites you eventually. Sometimes subset is a view, sometimes a copy, and pandas can't always tell either. Use subset = df[df.status == 'active'].copy() to make the intent explicit.
Getting SettingWithCopyWarning on a line that filters then assigns a new column:
subset = df[df.status == "active"]
subset["flag"] = TrueIt works and the values look right in this case. Is the warning ever actually safe to ignore, or does that habit come back to bite you?
It bites you eventually. Sometimes subset is a view, sometimes a copy, and pandas can't always tell either. Use subset = df[df.status == 'active'].copy() to make the intent explicit.
We replaced custom sensors with data contracts and row count checks.
ELI5: think of it like a phone book. If it's sorted by last name and you search by last name, that's fast. Search by first name instead and you're flipping through every page.
Sign in to reply.