What is the rationale for all comparisons returning false for IEEE754 NaN values?

I was a member of the IEEE-754 committee, I’ll try to help clarify things a bit. First off, floating-point numbers are not real numbers, and floating-point arithmetic does not satisfy the axioms of real arithmetic. Trichotomy is not the only property of real arithmetic that does not hold for floats, nor even the most important. … Read more

How to check if any value is NaN in a Pandas DataFrame

jwilner’s response is spot on. I was exploring to see if there’s a faster option, since in my experience, summing flat arrays is (strangely) faster than counting. This code seems faster: df.isnull().values.any() import numpy as np import pandas as pd import perfplot def setup(n): df = pd.DataFrame(np.random.randn(n)) df[df > 0.9] = np.nan return df def … Read more

Set value for particular cell in pandas DataFrame using index

RukTech’s answer, df.set_value(‘C’, ‘x’, 10), is far and away faster than the options I’ve suggested below. However, it has been slated for deprecation. Going forward, the recommended method is .iat/.at. Why df.xs(‘C’)[‘x’]=10 does not work: df.xs(‘C’) by default, returns a new dataframe with a copy of the data, so df.xs(‘C’)[‘x’]=10 modifies this new dataframe only. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)