Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions klib/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def cat_plot(
if n_unique <= 2:
lim_top = lim_bot = int(n_unique // 2)

value_counts_top = value_counts[0:lim_top]
value_counts_top = value_counts[:lim_top]
value_counts_idx_top = value_counts_top.index.tolist()
value_counts_bot = value_counts[-lim_bot:]
value_counts_idx_bot = value_counts_bot.index.tolist()
Expand Down Expand Up @@ -683,7 +683,7 @@ def missingval_plot(
ax1.set(frame_on=False, xlim=(-0.5, len(mv_cols) - 0.5))
ax1.set_ylim(0, np.max(mv_cols_ratio) * 100)
ax1.grid(linestyle=":", linewidth=1)
ax1.yaxis.set_major_formatter(ticker.PercentFormatter(decimals=0))
ax1.yaxis.set_major_formatter(ticker.PercentFormatter(decimals=1))
ax1.tick_params(axis="y", colors="#111111", length=1)

# annotate values on top of the bars
Expand Down
6 changes: 2 additions & 4 deletions klib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def _corr_selector(
corr: Union[pd.Series, pd.DataFrame],
split: Optional[
str
] = None, # Optional[Literal["pos", "neg", "above", "below"]] = None,
] = None, # Optional[Literal["pos", "neg", "high", "low"]] = None, Req:Python 3.8
threshold: float = 0,
) -> Union[pd.Series, pd.DataFrame]:
"""Select the desired correlations using this utility function.
Expand Down Expand Up @@ -185,9 +185,7 @@ def _memory_usage(data: pd.DataFrame, deep: bool = True) -> float:
Memory usage in megabytes
"""
data = pd.DataFrame(data).copy()
return round(
data.memory_usage(index=True, deep=deep).sum() / (1024 ** 2), 2
)
return round(data.memory_usage(index=True, deep=deep).sum() / (1024 ** 2), 2)


def _missing_vals(data: pd.DataFrame) -> Dict[str, Any]:
Expand Down