<Python>判斷變數是否是DataFrame 或者 Series

清風oo發表於2018-12-17

https://stackoverflow.com/questions/14808945/check-if-variable-is-dataframe

 

Use the built-in isinstance() function.

1 import pandas as pd
2 
3 def f(var):
4     if isinstance(var, pd.DataFrame):
5         print "do stuff"

 

 

相關文章