Skip to content

Commit

Permalink
Merge pull request #11 from RTIInternational/pandas-2-bugfix
Browse files Browse the repository at this point in the history
Use python 3.11 and pandas 2.1.1
  • Loading branch information
pzirali authored Jan 4, 2024
2 parents f25bb2d + 805cac5 commit af38b63
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 50 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See [docs/design.md](./docs/design.md) for a discussion of the package's design.

To set up a Python development environment for `crcsim`:

1. Create a Python virtual environment based on Python 3.6. (Currently, support is limited to Python 3.6, because that is the version installed on the RTI Cluster, which is where we expect to deploy and run the experiments.)
1. Create a Python virtual environment based on Python 3.11.
1. Activate the virtual environment.
1. Install development dependencies with `pip install -r requirements.txt`.
1. Install `crcsim` with `pip install -e .`. The `-e` option specifies "development" mode, meaning that any changes you make to the code are recognized immediately without having to reinstall the package.
Expand Down
10 changes: 5 additions & 5 deletions crcsim/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def summarize(self):
stage_counts = clinical_detections.new_state.value_counts()
stage_counts.index = stage_counts.index.str.replace("CLINICAL_", "").str.lower()
onset_distrib = stage_counts / len(clinical_detections)
for stage, value in onset_distrib.iteritems():
for stage, value in onset_distrib.items():
replication_output_row[f"crc_onset_proportion_{stage}"] = value

# Among all individuals who died from CRC, mean time between the onset of CRC
Expand Down Expand Up @@ -779,7 +779,7 @@ def compute_status_arrays(self):
f"Unexpected: more than one death event for person {p}"
)
else:
death_age = int(death.time)
death_age = int(death.time.iloc[0])

alive = np.arange(max_age + 1)
alive = np.where(alive > death_age, 0, 1)
Expand Down Expand Up @@ -906,11 +906,11 @@ def compute_status_arrays(self):
f"Unexpected: more than one clinical onset event for person {p}"
)
# Clinical onset overall
clinical_detection_age = int(clinical_detection.time)
clinical_detection_age = int(clinical_detection.time.iloc[0])
clinical_onset[clinical_detection_age] = 1
# Five-year survival overall
clinical_detection_age_decimal = float(clinical_detection.time)
death_age_decimal = float(death.time)
clinical_detection_age_decimal = float(clinical_detection.time.iloc[0])
death_age_decimal = float(death.time.iloc[0])
crc_onset_to_death = death_age_decimal - clinical_detection_age_decimal
if crc_onset_to_death > 5:
five_year_survival[clinical_detection_age] = 1
Expand Down
6 changes: 3 additions & 3 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Requirements needed for installing and using the package. Include
# everything necessary to satisfy setup.py's install_requires section.
fire
pandas
pandas==2.1.1

# Additional requirements needed for development.
black==22.8.0
black==23.1.0
flake8==3.8.3
isort==5.2.0
mypy==0.812
mypy==1.4.1
pytest==5.4.3
wheel==0.34.2
pip-tools
Expand Down
59 changes: 18 additions & 41 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile
#
appdirs==1.4.4
# via virtualenv
attrs==19.3.0
# via pytest
black==22.8.0
black==23.1.0
# via -r requirements.in
cfgv==3.1.0
# via pre-commit
click==8.0.4
# via
# black
# pip-tools
dataclasses==0.8
# via black
distlib==0.3.1
# via virtualenv
enum34==1.1.10
# via fire
filelock==3.0.12
# via virtualenv
fire==0.3.1
Expand All @@ -28,37 +28,27 @@ flake8==3.8.3
# via -r requirements.in
identify==1.4.25
# via pre-commit
importlib-metadata==1.7.0
# via
# click
# flake8
# pluggy
# pre-commit
# pytest
# virtualenv
importlib-resources==3.0.0
# via
# pre-commit
# virtualenv
isort==5.2.0
# via -r requirements.in
mccabe==0.6.1
# via flake8
more-itertools==8.4.0
# via pytest
mypy-extensions==0.4.3
mypy==1.4.1
# via -r requirements.in
mypy-extensions==1.0.0
# via
# black
# mypy
mypy==0.812
# via -r requirements.in
nodeenv==1.4.0
# via pre-commit
numpy==1.19.1
numpy==1.26.3
# via pandas
packaging==20.4
# via pytest
pandas==1.1.0
packaging==23.2
# via
# black
# pytest
pandas==2.1.1
# via -r requirements.in
pathspec==0.9.0
# via black
Expand All @@ -76,11 +66,9 @@ pycodestyle==2.6.0
# via flake8
pyflakes==2.2.0
# via flake8
pyparsing==2.4.7
# via packaging
pytest==5.4.3
# via -r requirements.in
python-dateutil==2.8.1
python-dateutil==2.8.2
# via pandas
pytz==2020.1
# via pandas
Expand All @@ -89,33 +77,22 @@ pyyaml==5.3.1
six==1.15.0
# via
# fire
# packaging
# python-dateutil
# virtualenv
termcolor==1.1.0
# via fire
toml==0.10.1
# via pre-commit
tomli==1.2.3
# via black
typed-ast==1.4.3
# via
# black
# mypy
typing-extensions==4.1.1
# via
# black
# mypy
# via mypy
tzdata==2023.4
# via pandas
virtualenv==20.0.28
# via pre-commit
wcwidth==0.2.5
# via pytest
wheel==0.34.2
# via -r requirements.in
zipp==3.1.0
# via
# importlib-metadata
# importlib-resources

# The following packages are considered to be unsafe in a requirements file:
# pip

0 comments on commit af38b63

Please sign in to comment.