Answers for "pd check if series contains element"

1

check if dataframe contains infinity

df.replace([np.inf, -np.inf], np.nan).dropna(subset=["col1", "col2"], how="all")
Posted by: Guest on November-03-2020
1

python check if dataframe series contains string

mel_count=a['Names'].str.contains('Mel').sum()
if mel_count>0:
    print ("There are {m} Mels".format(m=mel_count))
Posted by: Guest on September-15-2020

Code answers related to "pd check if series contains element"

Python Answers by Framework

Browse Popular Code Answers by Language