question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: Compare type `int64` with `Int64` fails

See original GitHub issue
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

pd.api.types.pandas_dtype("int64") == "Int64"

Problem description

The code above fails (TypeError: data type 'Int64' not understood) while the following cases pass:

pd.api.types.pandas_dtype("int64") == "int64"
pd.api.types.pandas_dtype("Int64") == "Int64"
pd.api.types.pandas_dtype("Int64") == "int64"

Expected Output

False

Output of pd.show_versions()

INSTALLED VERSIONS

commit : c7f7443c1bad8262358114d5e88cd9c8a308e8aa python : 3.7.11.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19041 machine : AMD64 processor : Intel64 Family 6 Model 142 Stepping 10, GenuineIntel byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : None.None

pandas : 1.3.1 numpy : 1.20.3 pytz : 2021.1 dateutil : 2.8.2 pip : 21.2.2 setuptools : 52.0.0.post20210125 Cython : 0.29.24 pytest : 6.1.2 hypothesis : 6.14.1 sphinx : 4.0.2 blosc : None feather : None xlsxwriter : 1.4.4 lxml.etree : 4.6.3 html5lib : 1.1 pymysql : 1.0.2 psycopg2 : None jinja2 : 3.0.1 IPython : 7.22.0 pandas_datareader: None bs4 : 4.9.3 bottleneck : 1.3.2 fsspec : 2021.07.0 fastparquet : None gcsfs : None matplotlib : 3.4.2 numexpr : 2.7.3 odfpy : None openpyxl : 3.0.7 pandas_gbq : None pyarrow : 3.0.0 pyxlsb : None s3fs : 0.4.2 scipy : 1.6.2 sqlalchemy : 1.4.22 tables : 3.6.1 tabulate : 0.8.9 xarray : 0.19.0 xlrd : 2.0.1 xlwt : 1.3.0 numba : 0.53.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mzeitlin11commented, Nov 24, 2021

Can you give me an example for how to add a regression test for this issue? Thank you 😃

I’d recommend looking at closed good first issues about testing (for example from https://github.com/pandas-dev/pandas/issues?q=is%3Aissue+label%3A"good+first+issue"+is%3Aclosed+label%3A"Needs+Tests"). If you look at some pull requests which close the issue, those should be good examples

0reactions
simonjayhawkinscommented, Jan 20, 2022

closing as tests added in #44840

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot compare types 'ndarray(dtype=int64)' and 'int64'
I have a column in my dataframe with barcodes and created a dictionary to map barcodes to item ids. I am creating a...
Read more >
Python error TypeError Cannot compare types ndarray dtype ...
Python error TypeError Cannot compare types ndarray dtype int64 and str. 0 votes. I'm trying to execute the following python code:
Read more >
cannot compare a dtyped [int64] array with a scalar of type [bool]
Hey all, I want to create a new column ,which is based on the two condition, Can any one tell what is wrong...
Read more >
Help understanding type error: Int64 and Number - New to Julia
When I pass this value to the function I get the following error (please see argument number 3). Since both Int64 and Float64...
Read more >
Progress INTEGER and INT64 data types
Where can the OpenEdge INT64 data type be used in 4GL/ABL? ... be assigned to an INT64 data type otherwise a run-time error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found