<Python>判断变量是否是DataFrame 或者 Series

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"

 

 
posted @ 2018-12-17 22:52  清风oo  阅读(9632)  评论(0编辑  收藏  举报