Skip to content

Commit

Permalink
Remove split_six utility function (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conengmo authored Apr 3, 2024
1 parent d5a2cc2 commit 32cd619
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions branca/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@

from jinja2 import Environment, PackageLoader

try:
import pandas as pd
except ImportError:
pd = None

try:
import numpy as np
except ImportError:
Expand Down Expand Up @@ -203,39 +198,6 @@ def color_brewer(color_code, n=6):
return color_scheme


def split_six(series=None):
"""
Given a Pandas Series, get a domain of values from zero to the 90% quantile
rounded to the nearest order-of-magnitude integer. For example, 2100 is
rounded to 2000, 2790 to 3000.
Parameters
----------
series: Pandas series, default None
Returns
-------
list
"""
if pd is None:
raise ImportError("The Pandas package is required" " for this functionality")
if np is None:
raise ImportError("The NumPy package is required" " for this functionality")

def base(x):
if x > 0:
base = pow(10, math.floor(math.log10(x)))
return round(x / base) * base
else:
return 0

quants = [0, 50, 75, 85, 90]
# Some weirdness in series quantiles a la 0.13.
arr = series.values
return [base(np.percentile(arr, x)) for x in quants]


def image_to_url(image, colormap=None, origin="upper"):
"""Infers the type of an image argument and transforms it into a URL.
Expand Down

0 comments on commit 32cd619

Please sign in to comment.