bitskitten 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitskitten
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: EDA reports, plots and sklearn-compatible encoders
5
5
  Author: Caerno
6
6
  License-Expression: Apache-2.0
@@ -6,7 +6,7 @@ Submodules stay importable on their own (`from bitskitten import output`),
6
6
  which is also how the zipped drop-in build is used: `from classes import NanFixer`.
7
7
  '''
8
8
 
9
- __version__ = "0.2.0"
9
+ __version__ = "0.2.1"
10
10
 
11
11
  from .classes import Digitalize, Encoder, FeatureTrans, NanFixer, SlowPolyLinearReg
12
12
  from .input import number
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitskitten
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: EDA reports, plots and sklearn-compatible encoders
5
5
  Author: Caerno
6
6
  License-Expression: Apache-2.0
@@ -45,7 +45,8 @@ def imperfection(df:pd.DataFrame,numeric:bool=False,no_nan:bool=False) -> pd.Dat
45
45
  return series
46
46
 
47
47
  missing_df = form_series(df.isnull().sum() / len(df),"NA Share")
48
- unique_df = form_series(df.apply(pd.unique),"Values")
48
+ # reduce: equal-length uniques (e.g. a single column) would otherwise expand into a frame
49
+ unique_df = form_series(df.apply(pd.unique, result_type="reduce"),"Values")
49
50
  nunique_df = form_series(unique_df.apply(len),"Num. of unique")
50
51
  type_df = form_series(df.dtypes,"Type")
51
52
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "bitskitten"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "EDA reports, plots and sklearn-compatible encoders"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -59,6 +59,14 @@ def test_imperfection(df):
59
59
  assert set(O.imperfection(df, numeric=True, no_nan=True).index) == {"age", "fare", "survived"}
60
60
 
61
61
 
62
+
63
+ def test_imperfection_equal_uniques():
64
+ # every column has the same number of unique values, a single column included
65
+ one = pd.DataFrame({"a": ["x", None, "y"]})
66
+ assert O.imperfection(one).loc["a", "Num. of unique"] == 3
67
+ two = pd.DataFrame({"a": ["x", None, "y"], "n": [1, 2, None]})
68
+ assert list(O.imperfection(two, numeric=True, no_nan=True).index) == ["a", "n"]
69
+
62
70
  def test_multicolumn(df):
63
71
  assert O.multicolumn(df.sample(1, random_state=0).T, cols=3) is not None
64
72
 
File without changes
File without changes
File without changes
File without changes
File without changes