Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'pandas' has no attribute 'Float64Dtype' #998

Closed
JohannesWiesner opened this issue Feb 21, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@JohannesWiesner
Copy link

Describe the issue or bug

I get an AttributeError: module 'pandas' has no attribute 'Float64Dtype' when trying to import pandas2ri.

To Reproduce

from rpy2.robjects import pandas2ri

Error

  Cell In[2], line 1
    from rpy2.robjects import pandas2ri

  File ~/.conda/envs/test_1/lib/python3.9/site-packages/rpy2/robjects/pandas2ri.py:152
    pandas.Float64Dtype: functools.partial(

  File ~/.conda/envs/test_1/lib/python3.9/site-packages/pandas/__init__.py:258 in __getattr__
    raise AttributeError(f"module 'pandas' has no attribute '{name}'")

AttributeError: module 'pandas' has no attribute 'Float64Dtype'

Additional context

(csp_wiesner_johannes) johannes.wiesner@pf41jell:~/work/repos/tcy$ conda activate test_1
(test_1) johannes.wiesner@pf41jell:~/work/repos/tcy$ python -m rpy2.situation
rpy2 version:
3.5.8
Python version:
3.9.16 | packaged by conda-forge | (main, Feb  1 2023, 21:39:03) 
[GCC 11.3.0]
Looking for R's HOME:
    Environment variable R_HOME: None
    Calling `R RHOME`: /home/johannes.wiesner/.conda/envs/test_1/lib/R
    Environment variable R_LIBS_USER: None
R's additions to LD_LIBRARY_PATH:

R version:
    In the PATH: R version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
    Loading R library from rpy2: OK
Additional directories to load R packages from:
None
C extension compilation:
  include:
  ['/home/johannes.wiesner/.conda/envs/test_1/lib/R/include']
  libraries:
  ['R', 'pcre2-8', 'lzma', 'bz2', 'z', 'rt', 'dl', 'm', 'iconv', 'icuuc', 'icui18n']
  library_dirs:
  ['/home/johannes.wiesner/.conda/envs/test_1/lib', '/home/johannes.wiesner/.conda/envs/test_1/lib/R/lib', '/home/johannes.wiesner/.conda/envs/test_1/lib']
  extra_compile_args:
  ['-std=c99']
  extra_link_args:
  ['-Wl,--export-dynamic', '-fopenmp', '-Wl,-O2', '-Wl,--sort-common', '-Wl,--as-needed', '-Wl,-z,relro', '-Wl,-z,now', '-Wl,--disable-new-dtags', '-Wl,--gc-sections', '-Wl,--allow-shlib-undefined', '-Wl,-rpath,/home/johannes.wiesner/.conda/envs/test_1/lib', '-Wl,-rpath-link,/home/johannes.wiesner/.conda/envs/test_1/lib']
Directory for the R shared library:
lib

Versions of pandas and R

pandas: 1.1.5
R installed with conda r-base: 4.2.2
@JohannesWiesner JohannesWiesner added the bug Something isn't working label Feb 21, 2023
@JohannesWiesner
Copy link
Author

Could solve it by specifying r-base with r-base>=4.1,<4.2, instead of r-base>=4.1

@lgautier
Copy link
Member

Updating pandas should solve this. Float64Dtype was added in pandas 1.2.0:
https://pandas.pydata.org/pandas-docs/dev/whatsnew/v1.2.0.html#experimental-nullable-data-types-for-float-data

lgautier added a commit that referenced this issue Feb 24, 2023
* Specify pandas>=1.2.0

(issue #998)
@lgautier
Copy link
Member

Added pandas>=1.2.0 to install targets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants