Skip to content

Commit

Permalink
upgrade pandas version
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreRicoPSU committed Feb 18, 2023
1 parent 98f78ee commit 48e772f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 9 deletions.
8 changes: 5 additions & 3 deletions clarite/internal/utilities.py
Expand Up @@ -6,6 +6,9 @@
import pandas as pd
from pandas_genomics import GenotypeDtype

# GITHUB ISSUE #120: SettingWithCopyWarning on Regression runs
pd.set_option("mode.chained_assignment", None)


def print_wrap(func):
@wraps(func)
Expand Down Expand Up @@ -209,9 +212,8 @@ def _remove_empty_categories(
if data[var].cat.ordered:
print()
# GITHUB ISSUE #120: SettingWithCopyWarning on Regression runs
# data[var] = data[var].cat.remove_unused_categories()
data.loc[:, var] = data[var].cat.remove_unused_categories()

data[var] = data[var].cat.remove_unused_categories()
# data.loc[:, var] = data[var].cat.remove_unused_categories()
removed_categories = set(existing_cats) - set(data[var].cat.categories)
if len(removed_categories) > 0:
removed_cats[var] = removed_categories
Expand Down
2 changes: 1 addition & 1 deletion clarite/modules/analyze/regression/base.py
Expand Up @@ -105,7 +105,7 @@ def _validate_regression_params(self, regression_variables):

# Collect lists of regression variables
types = _get_dtypes(self.data)
rv_types = {v: t for v, t in types.iteritems() if v in regression_variables}
rv_types = {v: t for v, t in types.items() if v in regression_variables}
rv_count = 0
for dtype in ["binary", "categorical", "continuous", "genotypes"]:
self.regression_variables[dtype] = [
Expand Down
3 changes: 3 additions & 0 deletions clarite/modules/analyze/regression/glm_regression.py
Expand Up @@ -380,6 +380,9 @@ def run(self):
)
)

# TODO: Error on multiprocess after update to Python > 3.8
self.process_num = 1

if self.process_num == 1:
run_result = [
self._run_rv(
Expand Down
3 changes: 3 additions & 0 deletions clarite/modules/analyze/regression/interaction_regression.py
Expand Up @@ -263,6 +263,9 @@ def run(self):
)
)

# TODO: Error on multiprocess after update to Python > 3.8
self.process_num = 1

if self.process_num == 1:
run_result = [
self._run_interaction(
Expand Down
3 changes: 3 additions & 0 deletions clarite/modules/analyze/regression/weighted_glm_regression.py
Expand Up @@ -301,6 +301,9 @@ def run(self):
)
)

# TODO: Error on multiprocess after update to Python > 3.8
self.process_num = 1

if self.process_num == 1:
run_result = [
self._run_weighted_rv(
Expand Down
4 changes: 2 additions & 2 deletions clarite/modules/survey/survey_model.py
Expand Up @@ -111,7 +111,7 @@ def _stata_linearization_vcov(self, X: pd.DataFrame, y: pd.DataFrame):
).set_index("clust", append=True)

# Get sum of d_hat within each cluster (rows = clusters, columns = variables)
jdata = d_hat.groupby(axis=0, level="clust").apply(sum)
jdata = d_hat.groupby(axis=0, level="clust", group_keys=False).apply(sum)

if self.design.has_strata:
# Add strata label to jdata (just updates the index labels)
Expand All @@ -136,7 +136,7 @@ def center_strata(data, single_cluster_setting, pop_mean):
# This results in a value of 0 for the strata when there is only 1 cluster
return data - data.mean()

jdata = jdata.groupby(axis=0, level="strat").apply(
jdata = jdata.groupby(axis=0, level="strat", group_keys=False).apply(
lambda g: center_strata(g, self.design.single_cluster, d_hat.mean())
)

Expand Down
5 changes: 5 additions & 0 deletions docs/source/release-history.rst
Expand Up @@ -2,6 +2,11 @@
Release History
===============

v2.3.1 (2023-01-10)
-------------------

Bug fixes (consult issues) and updating packages to Python 3.10

v2.2.0 (2021-07-19)
-------------------

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "clarite"
version = "2.3.1"
version = "2.3.2"
description = "CLeaning to Analysis: Reproducibility-based Interface for Traits and Exposures"
authors = ["Andre Rico <alr6366@psu.edu>"]
license = "BSD-3-Clause"
Expand All @@ -16,9 +16,9 @@ classifiers=[
]

[tool.poetry.dependencies]
python = " >=3.8.0,<3.11.0"
python = ">=3.8.0,<3.11.0"
click = ">7"
pandas = "~1.3"
pandas = "^1.3"
scipy = "^1.9"
seaborn = ">0.9"
statsmodels = "^0.13"
Expand Down

0 comments on commit 48e772f

Please sign in to comment.