检查数据框是 Pandas.Dataframe 还是 pandas.Series 的最佳方法是什么?
to expand on Ryan's comment:
isinstance(df,pd.DataFrame)
will return True
if it is a dataframe. to check if it is a series, it would be isinstance(df,pd.Series)
.
另一种方法:
type(your_object)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.