Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
check pandas variable type
#1
I am trying to check variable's data type is list or dataframe.
When I got type(df_c) is Out[155]: pandas.core.frame.DataFrame.
Checking it again by type(df_c) == 'pandas.core.frame.DataFrame', it showed False, not True. <-- I think it should print "True" rather than "False".

import pandas as pd

c=[1,2,3]

df_c=pd.DataFrame(c)

type(df_c)
Out[155]: pandas.core.frame.DataFrame

type(df_c) == 'pandas.core.frame.DataFrame'
Out[156]: False
Reply


Messages In This Thread
check pandas variable type - by cools0607 - Jun-12-2020, 07:47 AM
RE: check pandas variable type - by buran - Jun-12-2020, 08:47 AM
RE: check pandas variable type - by cools0607 - Jun-12-2020, 09:21 AM
RE: check pandas variable type - by buran - Jun-12-2020, 09:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  isinstance() always return true for object type check Yoki91 2 2,587 Jul-22-2020, 06:52 PM
Last Post: Yoki91
  Python - change variable type during program execution ple 1 2,403 Apr-12-2020, 08:43 AM
Last Post: buran
  Type hinting - return type based on parameter micseydel 2 2,518 Jan-14-2020, 01:20 AM
Last Post: micseydel
  How to check hardware type? MuntyScruntfundle 4 3,050 Feb-16-2019, 12:23 PM
Last Post: snippsat
  Storing MySQL BIT Data Type data in python variable krushna 2 3,508 Dec-31-2018, 01:28 AM
Last Post: krushna
  how i can check the input type? Firdaos 3 2,871 Dec-13-2018, 11:39 PM
Last Post: wavic
  how to check for file type in a folder SoulsKeeper 4 4,978 Sep-15-2018, 02:48 PM
Last Post: ichabod801
  What would be a way to check if a variable or class existed in an if? Klar 8 5,142 Dec-28-2017, 08:19 PM
Last Post: nilamo
  check if value of passed variable has uppercase characters in it. wfsteadman 3 3,265 Sep-01-2017, 05:52 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020