metacountregressor 0.1.146__py3-none-any.whl → 0.1.148__py3-none-any.whl

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.
@@ -302,11 +302,12 @@ def transform_dataframe(df, config):
302
302
  for column, settings in config.items():
303
303
  if settings['type'] == 'bin':
304
304
  # Apply binning
305
- binned = pd.cut(
306
- df[column],
305
+ pd.cut(
306
+ binned = df[column],
307
307
  bins=settings['bins'],
308
308
  labels=settings['labels'],
309
309
  right=False,
310
+ duplicates='drop'
310
311
 
311
312
  )
312
313
  # One-hot encode the binned column
@@ -390,7 +391,7 @@ def PCA_code(X, n_components=5):
390
391
 
391
392
 
392
393
  def interactions(df, keep=None, drop_this_perc=0.6, interact = False):
393
-
394
+ full_columns = df.columns
394
395
  if interact:
395
396
  interactions_list = []
396
397
  for i, var_i in enumerate(df.columns):
@@ -419,11 +420,11 @@ def interactions(df, keep=None, drop_this_perc=0.6, interact = False):
419
420
  # Remove `keep` columns from the correlation matrix
420
421
  if keep is not None:
421
422
  missing_columns = [col for col in keep if col not in df.columns]
422
-
423
+
423
424
  if missing_columns:
424
425
  print(f"The following columns are not in the DataFrame and will be ignored: {missing_columns}")
425
426
  keep = [col for col in keep if col not in df.columns]
426
- df_corr = df.drop(columns=keep, errors='ignore') # Exclude `keep` columns
427
+ df_corr = df.drop(columns=keep, errors='ignore', inplace=False) # Exclude `keep` columns
427
428
  else:
428
429
  df_corr = df
429
430
 
@@ -438,7 +439,7 @@ def interactions(df, keep=None, drop_this_perc=0.6, interact = False):
438
439
 
439
440
  # Ensure `keep` columns are not dropped
440
441
  if keep is not None:
441
- to_drop = [column for column in to_drop if column not in keep]
442
+ to_drop = [column for column in to_drop if column not in full_columns]
442
443
 
443
444
  # Drop the identified features
444
445
  df.drop(to_drop, axis=1, inplace=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: metacountregressor
3
- Version: 0.1.146
3
+ Version: 0.1.148
4
4
  Summary: Extensions for a Python package for estimation of count models.
5
5
  Home-page: https://github.com/zahern/CountDataEstimation
6
6
  Author: Zeke Ahern
@@ -3,7 +3,7 @@ metacountregressor/_device_cust.py,sha256=759fnKmTYccJm4Lpi9_1reurh6OB9d6q9soPR0
3
3
  metacountregressor/app_main.py,sha256=vY3GczTbGbBRalbzMkl_9jVW7RMgEOc6z2Dr1IZJv9c,10014
4
4
  metacountregressor/data_split_helper.py,sha256=M2fIMdIO8znUaYhx5wlacRyNWdQjNYu1z1wkE-kFUYU,3373
5
5
  metacountregressor/halton.py,sha256=jhovA45UBoZYU9g-hl6Lb2sBIx_ZBTNdPrpgkzR9fng,9463
6
- metacountregressor/helperprocess.py,sha256=MTu1dXAejrN-kLcTg2EP0ISOVlPGUkxQs25Q9cqxcPs,21023
6
+ metacountregressor/helperprocess.py,sha256=qkc1rol01UV65hes8kEBmpIZizShI9P7kwQyJwb4E8k,21106
7
7
  metacountregressor/main.py,sha256=2Rx_mGIGzl4lhwkMb7DHvsBaawqEakKiVR1Yr2uG9Yo,22819
8
8
  metacountregressor/main_old.py,sha256=eTS4ygq27MnU-dZ_j983Ucb-D5XfbVF8OJQK2hVVLZc,24123
9
9
  metacountregressor/metaheuristics.py,sha256=1Tm_BS8HxumEo9fteIwTTkfiJXbfH6wlfSmY0tSt77A,106289
@@ -13,8 +13,8 @@ metacountregressor/setup.py,sha256=5UcQCCLR8Fm5odA3MX78WwahavxFq4mVD6oq0IuQvAY,9
13
13
  metacountregressor/single_objective_finder.py,sha256=jVG7GJBqzSP4_riYr-kMMKy_LE3SlGmKMunNhHYxgRg,8011
14
14
  metacountregressor/solution.py,sha256=Se3-NMxuRFacPN9f3qfGzkKeIccs8cbe4ebkV0UsGlA,278325
15
15
  metacountregressor/test_generated_paper2.py,sha256=pwOoRzl1jJIIOUAAvbkT6HmmTQ81mwpsshn9SLdKOg8,3927
16
- metacountregressor-0.1.146.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
- metacountregressor-0.1.146.dist-info/METADATA,sha256=AuRoXoD9mbx43mFObuM90pB7l7lGfEBkiCVQcEvgBec,23434
18
- metacountregressor-0.1.146.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
19
- metacountregressor-0.1.146.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
20
- metacountregressor-0.1.146.dist-info/RECORD,,
16
+ metacountregressor-0.1.148.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
+ metacountregressor-0.1.148.dist-info/METADATA,sha256=SIn0HT25dxt3azDtNfRBd3sNrW-_dE-DoRyWMpXv2pw,23434
18
+ metacountregressor-0.1.148.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
19
+ metacountregressor-0.1.148.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
20
+ metacountregressor-0.1.148.dist-info/RECORD,,