AllenDowney / ThinkStats2

Text and supporting code for Think Stats, 2nd Edition
http://allendowney.github.io/ThinkStats2/
GNU General Public License v3.0
4.01k stars 11.23k forks source link

Code in Chapter 6 Exercises for 'def InterpolateSample' thows an error #179

Closed resonates7 closed 2 years ago

resonates7 commented 3 years ago

'def InterpolateSample' throws an error b/c NumPy cannot convert a float64 type to an integer inside that function. The following line of code needs to be changed to convert the 'freq' value to an integer. Easy fix, but took me a minute to figure it out.

    vals = np.linspace(row.log_lower, row.log_upper, row.freq.**astype(np.int64)**)
thakkery commented 3 years ago

I had the same issue. I did:

vals = np.linspace(row.log_lower, row.log_upper, int(row.freq))
AllenDowney commented 2 years ago

This should be resolved by e136acc1047f4dbc3cd9bc7935420b8d6f92ce40