Skip to content

Commit

Permalink
linting + simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
akanz1 committed Sep 23, 2022
1 parent d2d19d1 commit 925ac98
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/klib/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
import pandas as pd
import scipy
import seaborn as sns
from matplotlib import ticker
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.colors import to_rgb

from klib.utils import _corr_selector
from klib.utils import _missing_vals
from klib.utils import _validate_input_bool
Expand All @@ -23,9 +27,6 @@
from klib.utils import _validate_input_range
from klib.utils import _validate_input_smaller
from klib.utils import _validate_input_sum_larger
from matplotlib import ticker
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.colors import to_rgb

__all__ = ["cat_plot", "corr_mat", "corr_plot", "dist_plot", "missingval_plot"]

Expand Down Expand Up @@ -93,12 +94,12 @@ def cat_plot(

if n_unique < top + bottom:
if bottom > top:
lim_top = int(n_unique // 2) if int(n_unique // 2) < top else top
lim_top = min(int(n_unique // 2), top)
lim_bot = n_unique - lim_top
else:
lim_bot = int(n_unique // 2) if int(n_unique // 2) < bottom else bottom
lim_bot = min(int(n_unique // 2), bottom)
lim_top = n_unique - lim_bot

value_counts_top = value_counts[:lim_top]
value_counts_idx_top = value_counts_top.index.tolist()
value_counts_bot = value_counts[-lim_bot:] if lim_bot > 0 else pd.DataFrame()
Expand Down

0 comments on commit 925ac98

Please sign in to comment.