Avatar ·

What does Tilda mean in Pandas?

📁 Advanced Python Topics

What does Tilda mean in this case?

df.loc[~non_numberic_profits]

In the column non_numberic_profits, rows were set that do not meet the data type float. That is, not numbers, but some letters or symbols.

What does Tilda mean in this case? What function does it perform?

After this, the following line of code

df.profit = df.profit.apply(pd.to_numeric)

as I understand it, transforms it precisely into the data type float. But what does it transform? The remaining values? I do not quite understand what the operator Tilda performs in this case.