
Want to check whether a Python Pandas string series only contains digits? Use str.isdigit:
df['x'].str.isdigit()
This returns a boolean series, with df’s index. You can then convert the digit-containing strings to integers:
df.loc[pd.col('x').str.isdigit(), 'x'].astype(int)
