Skip to content

Commit

Permalink
0.3.2:
Browse files Browse the repository at this point in the history
- fixed future pandas incompabilities
  • Loading branch information
Braffolk committed Jun 11, 2024
1 parent a553b20 commit c04c975
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def version_libs(libs, precisions, versions):
INSTALL_REQUIRES = version_libs(libs, precisions, versions)

setup(name='weightipy',
version='0.3.1',
version='0.3.2',
author='Remi Sebastian Kits',
author_email='[email protected]',
packages=find_packages(exclude=['tests']),
Expand Down
10 changes: 6 additions & 4 deletions weightipy/rim.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def add_group(self, name=None, filter_def=None, targets=None):

def _compute(self):
self._get_base_factors()
self._df[self._weight_name()].replace(0.00, 1.00, inplace=True)
self._df[self._weight_name()].replace(-1.00, np.NaN, inplace=True)
self._df[self._weight_name()] = self._df[self._weight_name()].replace(0.00, 1.00)
self._df[self._weight_name()] = self._df[self._weight_name()].replace(-1.00, np.NaN)
if list(self._group_targets.keys()):
self._adjust_groups()
if self.total > 0 and not list(self._group_targets.keys()):
Expand Down Expand Up @@ -316,7 +316,7 @@ def dataframe(self, df, key_column=None):
columns = self._columns(add_columns=[key_column])
columns.extend(all_filter_cols)
df = df.copy()[columns]
df[self._weight_name()].replace(0, np.NaN, inplace=True)
df[self._weight_name()] = df[self._weight_name()].replace(0, np.NaN)
df.dropna(subset=[self._weight_name()], inplace=True)
return df

Expand Down Expand Up @@ -484,6 +484,8 @@ def __init__(self, dataframe, targets,
self.dataframe = dataframe
self.weight_column_name = weight_column_name

self.dataframe[self.weight_column_name] = 1.0

self.cap = cap
self.anesrake_cap_correction = anesrake_cap_correction
self._use_cap = _use_cap
Expand Down Expand Up @@ -621,7 +623,7 @@ def start(self):
diff_error = sum(abs(self.dataframe[self.weight_column_name]-old_weights))

self.iteration_counter = iteration # for the report
self.dataframe[self.weight_column_name].replace(0.00, 1.00, inplace=True)
self.dataframe[self.weight_column_name] = self.dataframe[self.weight_column_name].replace({0.0: 1.0})

if iteration == self.max_iterations:
print('Convergence did not occur in %s iterations' % iteration)
Expand Down
2 changes: 1 addition & 1 deletion weightipy/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '0.3.1'
version = '0.3.2'

0 comments on commit c04c975

Please sign in to comment.