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

Add min arg to UserDefined #114

Merged
merged 3 commits into from
Jul 25, 2021
Merged

Add min arg to UserDefined #114

merged 3 commits into from
Jul 25, 2021

Conversation

sjsrey
Copy link
Member

@sjsrey sjsrey commented Jul 25, 2021

This addresses #113

@sjsrey sjsrey requested review from martinfleis and darribas July 25, 2021 00:13
Copy link
Member

@martinfleis martinfleis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick response :). As I mention in the code, with min we're overriding the built-in function so we should ideally use a different keyword here.

lowest = mc.y.min()
if hasattr(mc, 'min'):
if mc.min:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if mc.min:
if mc.min is not None:

Otherwise it wouldn't work for min=0.

@@ -2256,9 +2266,10 @@ class UserDefined(MapClassifier):

"""

def __init__(self, y, bins):
def __init__(self, y, bins, min=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather use another keyword because now we're overriding built-in min(). Something like legend_min or lowest?

lowest = mc.y.min()
if hasattr(mc, 'lowest'):
if mc.lowest:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if mc.lowest:
if mc.lowest is not None:

Just to ensure we don't forget about this. We need to be explicit to ensure it works for 0.

@sjsrey sjsrey merged commit c64fa4c into pysal:master Jul 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants