how to check whether dataframe or series code example
Example 1: python check if is pandas dataframe
import pandas as pd
isinstance(df, pd.DataFrame)
Example 2: pandas check if series
type(x) is pd.DataFrame # NO
type(x) == pd.DataFrame # NO
isinstance(x, pd.DataFrame) # YES