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

[BUG] #185

Closed
2 tasks done
GG-Delta opened this issue Aug 20, 2023 · 4 comments
Closed
2 tasks done

[BUG] #185

GG-Delta opened this issue Aug 20, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@GG-Delta
Copy link

GG-Delta commented Aug 20, 2023

datar version checks

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

  • I have confirmed this bug exists on the latest version of datar and its backends.

Issue Description

Hey pwwang,
My apologies that I couldn't figure out the root problem myself. When trying to reproduce one of your examples using the starwars dataset using the count function it doesn't show the counts (i.e. the n column) for each category (as demonstrated in your example: https://pwwang.github.io/datar/notebooks/count/). My code is the following:

# Import Python modules
import pandas as pd
import numpy as np
import janitor
from datar.data import starwars
from datar.all import *

# Code to reproduce datar example using count
starwars >> count(f.species)

This code leads to this outcome (missing the n column):
Screenshot 2023-08-20 at 15 50 10

Expected Behavior

Expected behaviour: to generate the output with the count in a seperate column named n as shown in your tutorial example: https://pwwang.github.io/datar/notebooks/count/

Any hint how I could fix this would be highly appreciated! Many thanks in advance! All the best, Gernot

Installed Versions

datar 0.13.1 datar-numpy 0.2.1 datar-pandas 0.3.1

---- Update
Hey pwwang! Thanks a lot for taking a look into this issue! The output of data.getversions() is as follows:
python : 3.10.5 (main, Oct 7 2022, 13:57:40) [Clang 14.0.0 (clang-1400.0.29.102)] datar : 0.13.1 simplug : 0.3.2 executing : 1.2.0 pipda : 0.12.0 datar-numpy : 0.2.1 numpy : 1.25.2 datar-pandas: 0.3.1 pandas : 2.0.3

Thanks again & Cheers, Gernot

@GG-Delta GG-Delta added the bug Something isn't working label Aug 20, 2023
@pwwang
Copy link
Owner

pwwang commented Aug 21, 2023

I can't reproduce this.

In [1]: # Import Python modules
   ...: import pandas as pd
   ...: import numpy as np
   ...: from datar.data import starwars
   ...: from datar.all import *

In [2]: starwars >> count(f.species)
Out[2]: 
           species       n
          <object> <int64>
0            Human      35
1            Droid       6
2          Wookiee       2
3           Rodian       1
4             Hutt       1
5   Yoda's species       1
6       Trandoshan       1
...

Can you provide the output of datar.get_versions()?

@GG-Delta
Copy link
Author

Hey pwwang, Sure! Thanks a lot for taking a look into this issue! The output of data.getversions() is as follows:
python : 3.10.5 (main, Oct 7 2022, 13:57:40) [Clang 14.0.0 (clang-1400.0.29.102)] datar : 0.13.1 simplug : 0.3.2 executing : 1.2.0 pipda : 0.12.0 datar-numpy : 0.2.1 numpy : 1.25.2 datar-pandas: 0.3.1 pandas : 2.0.3

Thanks again & Cheers, Gernot

@GG-Delta GG-Delta reopened this Aug 21, 2023
@pwwang
Copy link
Owner

pwwang commented Aug 21, 2023

The problem should be the version of pandas. datar-pandas only supports pandas 1.x. You have pandas 2.x installed.

pandas 2.x uses pyarrow as backend, while pandas 1.x uses numpy. They are different in a lot of ways. We need a separate backend to support pandas 2.

@GG-Delta
Copy link
Author

Hey pwwang! Thanks a lot for checking! You are right! Indeed the issue is based on using a different pandas version. I just tested it with an older pandas version 1.5.3. And the datar count function worked as expected again - exactly as you suggested. I was not aware about the massive changes associated with pandas 2.x Unfortunately I need pandas 2.x for another functionality in this project... so it is a pity that I can't use datar in this context. Thank you again! All the best, Gernot
Screenshot 2023-08-21 at 22 34 58

@pwwang pwwang added this to To do in Support pandas v2 Sep 4, 2023
@pwwang pwwang moved this from To do to Done in Support pandas v2 Oct 8, 2023
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
No open projects
Development

No branches or pull requests

2 participants