Это мои тестовые данные:
Код: Выделить всё
import pandas as pd
df = pd.DataFrame(
{
"fruit": ["apple", "banana", "cherry", "", pd.NA]
},
dtype = "string"
)
Код: Выделить всё
>>> df.query("fruit != ''")
fruit
0 apple
1 banana
2 cherry
4
>>> df[df.fruit != '']
fruit
0 apple
1 banana
2 cherry
Подробнее здесь: https://stackoverflow.com/questions/791 ... nt-results