Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ch 3. Line 77 in Python Code #23

Closed
deulkkae opened this issue May 20, 2021 · 2 comments
Closed

Ch 3. Line 77 in Python Code #23

deulkkae opened this issue May 20, 2021 · 2 comments

Comments

@deulkkae
Copy link

deulkkae commented May 20, 2021

This line brings typeerror: TypeError: '>' not supported between instances of 'list' and 'float'

It would be better to correct this line to
print(np.mean(np.array(perm_diffs) > mean_b - mean_a))

@gedeck
Copy link
Owner

gedeck commented May 20, 2021

This is strange. It works in the notebook:
image

I looked into this and it works for me because in the notebook, the type of mean_b and mean_a is numpy.float64. In this case, numpy will implicitly convert the list to np.array and make it work. Your error message suggests that the means are float on your system. The floats are from:

session_times[session_times.Page == 'Page B'].Time.mean()

What Python, numpy and pandas versions are you using? I tested now using Python 3.9.4, numpy 1.20.2, and pandas 1.2.4.

@gedeck gedeck mentioned this issue Jul 31, 2021
@gedeck
Copy link
Owner

gedeck commented Aug 1, 2021

In #26, the same issue was reported. In this case, pandas was version 1.1.3 and numpy 1.19.5. I assume that the issue was caused by a regression in the mean function and that this is now fixed again.

I will therefore close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants