Skip to content

Instantly share code, notes, and snippets.

@Ken-Kuroki
Created May 10, 2020 04:49
Show Gist options
  • Save Ken-Kuroki/2576ec5ca4c6dac37a593ac51ecda574 to your computer and use it in GitHub Desktop.
Save Ken-Kuroki/2576ec5ca4c6dac37a593ac51ecda574 to your computer and use it in GitHub Desktop.
Find rows containing nan or inf
import pandas as pd
import numpy as np
df = pd.DataFrame([[1.,2.,np.nan,np.inf],[1.,2.,3.,4.,]]).T
df[np.isnan(df).any(axis=1) | np.isinf(df).any(axis=1)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment