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

Fix for Graph.describe() when the graph has a string index (#759) #760

Merged
merged 3 commits into from
Aug 5, 2024

Conversation

u3ks
Copy link
Contributor

@u3ks u3ks commented Jul 31, 2024

This PR fixes #759 .

Pandas aggregation functions pass the original string index to numba, and thats why it fails the type check.
To fix this we can either have two new numba mode calculation functions - one for strings, one for numbers or we can explicitly recast the index to integers, carry out the calculations using the numeric index and then reindex the results before returning them.

@u3ks u3ks changed the title Fix for Graph.describe() when the graph has a string index Fix for Graph.describe() when the graph has a string index (#759) Jul 31, 2024
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.4%. Comparing base (27776c3) to head (5f0c0eb).
Report is 36 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #760     +/-   ##
=======================================
- Coverage   85.4%   85.4%   -0.0%     
=======================================
  Files        150     150             
  Lines      15975   15983      +8     
=======================================
+ Hits       13641   13644      +3     
- Misses      2334    2339      +5     
Files Coverage Δ
libpysal/graph/base.py 96.5% <100.0%> (+<0.1%) ⬆️
libpysal/graph/tests/test_base.py 100.0% <100.0%> (ø)

... and 2 files with indirect coverage changes

libpysal/graph/base.py Outdated Show resolved Hide resolved
libpysal/graph/base.py Outdated Show resolved Hide resolved
@jGaboardi jGaboardi added bug functionality that: returns invalid, erroneous, or meaningless results; or doesn't work at all. graph labels Jul 31, 2024
Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
@martinfleis martinfleis merged commit 98d4cee into pysal:main Aug 5, 2024
12 checks passed
martinfleis added a commit that referenced this pull request Aug 29, 2024
* numba mode fix when graph has string index

* typing

* Apply suggestions from code review

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>

---------

Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug functionality that: returns invalid, erroneous, or meaningless results; or doesn't work at all. graph
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Graph.describe() does not work with non-integer index
3 participants