Home > Software engineering >  check if pandas dataframe is dataframe or series?
check if pandas dataframe is dataframe or series?

Time:07-21

What is the best way to check if a dataframe is a Pandas.Dataframe or pandas.Series?

CodePudding user response:

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).

CodePudding user response:

Another way of doing it:

type(your_object)

  • Related