https://towardsdatascience.com/beware-of-using-the-str-casefold-method-when-dealing-with-strings-in-python-bd7b7ccd59ea
#python #gems
#python #gems
Medium
Beware of Using the Casefold() Method when Dealing with Strings in Python
Although string handling in Python seems quite easy and fun, attention should be paid to the right use of certain methods; str.casefold()…
#pandas #gems
Не так-то просто использовать .isin в пандас сразу для нескольких полей. Единственное, что работает, это кортежи, списком не выйдет:
Не так-то просто использовать .isin в пандас сразу для нескольких полей. Единственное, что работает, это кортежи, списком не выйдет:
df[df[['DEVICE', 'READING']].apply(tuple, axis = 1).isin([('DEV1', 'READ1'), ('DEV1', 'READ2'), ('DEV2','READ1')])]
Stack Overflow
Pandas isin with multiple columns
I want to select all rows in a dataframe which contain values defined in a list.
I've got two approaches which both do not work as expected/wanted.
My dataframe looks something like this:
Timestamp
I've got two approaches which both do not work as expected/wanted.
My dataframe looks something like this:
Timestamp