Created
March 17, 2018 21:23
-
-
Save okdolly-001/3c1a191f32733a9b69345b6773d330f5 to your computer and use it in GitHub Desktop.
Check Nan and infinity in pandas and Numpy #np #pandas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Check if all elements in pandas/numpy are finite. notnull = isfinite | |
| Pandas: | |
| X_train.notnull().values.all() | |
| np.isfinite(X_train).all() | |
| 2. Check if any elements in Pandas is Na. | |
| Pandas: | |
| X_train.isnull().values.any() | |
| np.isnan(X_train).any() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment