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

07_04_random_forest in baseball_fantasy #1

Closed
AntoineLB13 opened this issue Dec 21, 2021 · 4 comments
Closed

07_04_random_forest in baseball_fantasy #1

AntoineLB13 opened this issue Dec 21, 2021 · 4 comments

Comments

@AntoineLB13
Copy link

Hello nathan,
in 07_04_random_forest, I am experiencing problems.
First of all, the DATA100 line does not take all the necessary directories into account. It is './data/100-game-sample/' instead of starting at the directory of Users/.
and, the line dfp = (pd.read_csv(path.join(DATA100, 'pitches.csv'))
.query("pitch_type.notnull() & pitch_type not in ('FO', 'PO')")) has an error to it: TypeError: unhashable type: 'numpy.ndarray'
I tried to fix it but I am no pro.
Wondering if you can tell me why it does not work like all the other files of every other chapter.

Great book by the way

@nathanbraun
Copy link
Owner

Thanks for letting me know about this. I just updated the DATA100 directory in that file to be more consistent with the rest of the files, you can try grabbing them again.

As for me, the line you reference:

dfp = (pd.read_csv(path.join(DATA100, 'pitches.csv'))
.query("pitch_type.notnull() & pitch_type not in ('FO', 'PO')")

works (I even copied and pasted what you had here), so not sure what's going on. Maybe try it with the updated DATA100 and let me know if it still doesn't work?

@AntoineLB13
Copy link
Author

AntoineLB13 commented Dec 24, 2021 via email

@nathanbraun
Copy link
Owner

Sometimes you can also specify engine='python' too. Like:

dfp = (pd.read_csv(path.join(DATA100, 'pitches.csv'))
.query("pitch_type.notnull() & pitch_type not in ('FO', 'PO')", engine='python')

But glad it's working now.

@AntoineLB13
Copy link
Author

AntoineLB13 commented Feb 24, 2022 via email

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