Skip to content

Commit a06778a

Browse files
authored
[DOC] Fix min_max_scale docstrings rendering (#1123)
* DOC: Fix `min_max_scale` docstrings rendering * Hide these methods docstrings rendering * Use mkdoc admonition from https://squidfunk.github.io/mkdocs-material/reference/admonitions/ * " -> ` * Drop `:` * Update CHANGELOG.md * FIx git comment prefixes * Fix git comment prefixes
1 parent db2c056 commit a06778a

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
- [ENH] New decorator `deprecated_kwargs` for breaking API. #1103 @Zeroto521
88
- [ENH] Extend select_columns to support non-string columns. Also allow selection on MultiIndex columns via level parameter. #1105 @samukweku
99
- [ENH] Performance improvement for groupby_topk. #1093 @samukweku
10-
- [EHN] `min_max_scale` drop `old_min` and `old_max` to fit sklearn's method API. Issue #1068 @Zeroto521
11-
- [EHN] Add `jointly` option for `min_max_scale` support to transform each column values or entire values. Default transform each column, similar behavior to `sklearn.preprocessing.MinMaxScaler`. Issue #1067 @Zeroto521
10+
- [ENH] `min_max_scale` drop `old_min` and `old_max` to fit sklearn's method API. Issue #1068 @Zeroto521
11+
- [ENH] Add `jointly` option for `min_max_scale` support to transform each column values or entire values. Default transform each column, similar behavior to `sklearn.preprocessing.MinMaxScaler`. (Issue #1067, PR #1112, PR #1123) @Zeroto521
1212

1313
## [v0.23.1] - 2022-05-03
1414

@@ -82,7 +82,7 @@
8282
- [DOC] Updated various documentation sources to reflect pyjanitor-dev ownership. @loganthomas
8383
- [INF] Fix `isort` automatic checks. Issue #845. @loganthomas
8484
- [ENH] `complete` function now uses variable args (\*args) - @samukweku
85-
- [EHN] Set `expand_column`'s `sep` default is `"|"`, same to `pandas.Series.str.get_dummies`. Issue #876. @Zeroto521
85+
- [ENH] Set `expand_column`'s `sep` default is `"|"`, same to `pandas.Series.str.get_dummies`. Issue #876. @Zeroto521
8686
- [ENH] Deprecate `limit` from fill_direction. fill_direction now uses kwargs. @samukweku
8787
- [ENH] Added `conditional_join` function that supports joins on non-equi operators. @samukweku
8888
- [INF] Speed up pytest via `-n` (pytest-xdist) option. Issue #881. @Zeroto521

janitor/functions/min_max_scale.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ def min_max_scale(
9696
1 to 14. Hence, 3 gets scaled not to 0 but approx. 0.15 instead, while 10
9797
gets scaled to approx. 0.69 instead.
9898
99+
!!! summary "Version Changed"
100+
101+
- 0.24.0
102+
- Deleted `old_min`, `old_max`, `new_min`, and `new_max` options.
103+
- Added `feature_range`, and `jointly` options.
104+
99105
:param df: A pandas DataFrame.
100106
:param feature_range: (optional) Desired range of transformed data.
101107
:param column_name: (optional) The column on which to perform scaling.
@@ -105,10 +111,6 @@ def min_max_scale(
105111
:raises ValueError: if the length of `feature_range` isn't equal to two.
106112
:raises ValueError: if the element of `feature_range` isn't number type.
107113
:raises ValueError: if `feature_range[1]` <= `feature_range[0]`.
108-
109-
Changed in version 0.24.0: Deleted "old_min", "old_max", "new_min", and
110-
"new_max" options.
111-
Changed in version 0.24.0: Added "feature_range", and "jointly" options.
112114
"""
113115

114116
if not (
@@ -125,24 +127,24 @@ def min_max_scale(
125127
if column_name is not None:
126128
df = df.copy() # Avoid to change the original DataFrame.
127129

128-
old_feature_range = df[column_name].pipe(min_max_value, jointly)
130+
old_feature_range = df[column_name].pipe(_min_max_value, jointly)
129131
df[column_name] = df[column_name].pipe(
130-
apply_min_max,
132+
_apply_min_max,
131133
*old_feature_range,
132134
*feature_range,
133135
)
134136
else:
135-
old_feature_range = df.pipe(min_max_value, jointly)
137+
old_feature_range = df.pipe(_min_max_value, jointly)
136138
df = df.pipe(
137-
apply_min_max,
139+
_apply_min_max,
138140
*old_feature_range,
139141
*feature_range,
140142
)
141143

142144
return df
143145

144146

145-
def min_max_value(df: pd.DataFrame, jointly: bool) -> tuple:
147+
def _min_max_value(df: pd.DataFrame, jointly: bool) -> tuple:
146148
"""
147149
Return the minimum and maximum of DataFrame.
148150
@@ -162,7 +164,7 @@ def min_max_value(df: pd.DataFrame, jointly: bool) -> tuple:
162164
return mmin, mmax
163165

164166

165-
def apply_min_max(
167+
def _apply_min_max(
166168
df: pd.DataFrame,
167169
old_min: int | float | pd.Series,
168170
old_max: int | float | pd.Series,

0 commit comments

Comments
 (0)