Comments (5)
I cannot reproduce this issue with the latest versions of all modules. The difference to your code is that mean_a
and mean_b
are of type numpy.float64
when I run the notebook. Your error message indicates that it is float
in your case. There must be a difference in the Python environment.
The same issue was reported a while ago #23 and #26, however we were not able to track it down to a specific version. The second report was using the M1 processor on a Mac. It could be that this causes the issue. Can you confirm what OS/hardware/Python versions you use?
In any case, I'm going to change the code as it seems to happen more often. I think your suggested code is too hard to read for new Python users. I will therefore use the following:
print(np.mean(np.array(perm_diffs) > mean_b - mean_a))
Can you confirm that it works for you?
from practical-statistics-for-data-scientists.
Yes, it worked!
I am using an Intel i7 version 10 processor running Python 3.8.5 under Windows 10.
from practical-statistics-for-data-scientists.
So it's not the hardware. Can you run this command so that we can compare the package versions:
pip list --format=freeze
Here is what I have currently installed using Python 3.10.4
cycler==0.11.0
dmba==0.1.0
fonttools==4.33.2
future==0.18.2
imbalanced-learn==0.9.0
imblearn==0.0
joblib==1.1.0
kiwisolver==1.4.2
matplotlib==3.5.1
numpy==1.22.3
packaging==21.3
pandas==1.4.2
patsy==0.5.2
Pillow==9.1.0
pip==22.0.4
prince==0.7.1
progressbar2==4.0.0
pydotplus==2.0.2
pygam==0.8.0
pyparsing==3.0.8
python-dateutil==2.8.2
python-utils==3.1.0
pytz==2022.1
scikit-learn==1.0.2
scipy==1.8.0
seaborn==0.11.2
setuptools==58.1.0
six==1.16.0
statsmodels==0.13.2
threadpoolctl==3.1.0
wheel==0.37.1
wquantiles==0.6
xgboost==1.6.0
from practical-statistics-for-data-scientists.
from practical-statistics-for-data-scientists.
I tried an environment using Python 3.8.5 with the same versions you used:
numpy==1.20.3
pandas==1.4.1
scipy==1.7.3
but see no problem with it.
I'll make the change to ensure that the code works for you.
from practical-statistics-for-data-scientists.
Related Issues (20)
- Errors and Questions in Ch5, 6, 7 HOT 3
- Again in Ch 5, 6, 7 HOT 3
- Incorrect variable reference Chi2 (Chapter 3 page 127) HOT 1
- Ch 3. Line 77 in Python Code HOT 2
- Ch. 2 - R Code Data and Sampling Distributions Lines 35, 36 HOT 1
- Pull request HOT 16
- Python Jupyter Notebook program output is different from what is shown there HOT 2
- Different histogram under the same number of bins HOT 2
- perm_fun use of set() HOT 2
- Possible Considerations on moving R into conda environment for consistency HOT 3
- Enable github CI for pull requests
- Add R build to CI HOT 3
- 水戸さん
- Resampling in chi square test HOT 1
- Adjust code to changes in Python packages
- Figure 7.1 (Python) - Broken HOT 3
- Anaconda - ResolvePackageNotFound HOT 2
- Statistics
- chi-square, resampling approach HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from practical-statistics-for-data-scientists.