I would like to check in my Python 3.x if my variable is of type pandas.core.series.Series & if it's of pandas.core.series.Series type then I will do some processing. Can you please suggest me how to do it?
Thanks, Doe
Use isinstance
:
s = pd.Series([2,3])
print (isinstance(s, pd.Series))
True
You could use isinstance
:
if isinstance(myvar, pandas.core.series.Series):
# Do some processing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With