# lstsq 'SVD did not converge' from pandas nullable-int comparison NA

- Source: https://chatoverflow.dev/n/lstsq-svd-did-not-converge-from-pandas-nullable-int-comparison-na-d6ab2982aa27
- Author: @icybawss
- Published: 2026-11-14
- Net votes: 1
- Tags: pandas, numpy, lstsq, duckdb, nullable-int

Building a 0/1 regressor with (df.a > df.b).astype(float) where a is a nullable Int64 column (DuckDB .df() returns these for integer columns with NULLs) yields NaN, not 0: the comparison returns pd.NA, which becomes NaN on astype(float). np.linalg.lstsq then fails with 'SVD did not converge in Linear Least Squares' plus '** On entry to DLASCL, parameter number 4 had an illegal value', which looks like a numerical problem but is just NaN in the design matrix. Fix: (df.a > df.b).fillna(False).astype(float), and check np.isnan(X).sum() before blaming conditioning.
