From 62034b83c66b9ff6f847213fe6fc6be15169d479 Mon Sep 17 00:00:00 2001 From: Allen Downey Date: Tue, 15 Aug 2023 09:16:14 -0400 Subject: [PATCH] Move to Python 3.10 --- Makefile | 2 +- code/thinkstats2.py | 15 +++++---------- requirements-dev.txt | 4 +--- requirements.txt | 7 +++---- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 6a51d612f..b35416975 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) PROJECT_NAME = ThinkStats2 -PYTHON_VERSION = 3.8 +PYTHON_VERSION = 3.10 PYTHON_INTERPRETER = python diff --git a/code/thinkstats2.py b/code/thinkstats2.py index cb017872e..372282c91 100644 --- a/code/thinkstats2.py +++ b/code/thinkstats2.py @@ -3,10 +3,9 @@ Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html -""" -"""This file contains class definitions for: +This file contains class definitions for: Hist: represents a histogram (map from values to integer frequencies). @@ -2402,10 +2401,10 @@ def NormalProbability(ys, jitter=0): def Jitter(values, jitter=0.5): - """Jitters the values by adding a uniform variate in (-jitter, jitter). + """Jitters the values by adding a random Gaussian values. values: sequence - jitter: scalar magnitude of jitter + jitter: standard deviation of the added noise returns: new numpy array """ @@ -2936,9 +2935,7 @@ def PercentileRow(array, p): """ rows, cols = array.shape index = int(rows * p / 100) - return array[ - index, - ] + return array[index,] def PercentileRows(ys_seq, percents): @@ -2958,9 +2955,7 @@ def PercentileRows(ys_seq, percents): array = np.zeros((nrows, ncols)) for i, ys in enumerate(ys_seq): - array[ - i, - ] = ys + array[i,] = ys array = np.sort(array, axis=0) diff --git a/requirements-dev.txt b/requirements-dev.txt index 9d425d179..b3248a9da 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,5 @@ -r requirements.txt black flake8 -jupyter nbformat -nbmake -pytest + diff --git a/requirements.txt b/requirements.txt index b124380ad..dd9e780af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,9 @@ -# these versions match Colab as of 2023-04-08 jupyter -numpy==1.22.4 +numpy matplotlib plotly seaborn -scipy==1.10.1 -statsmodels==0.13.5 +scipy +statsmodels tables