-
Notifications
You must be signed in to change notification settings - Fork 10
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
First Notebook example doesn't work: apparently expects a state data file to already be there? #2
Comments
Hi @akkana, the file you're looking for is here: https://github.com/PrincetonUniversity/historic_state_legislative_election_results/blob/2bf28f2ac1a74636b09dfb700eef08a4324d2650/state_legislative_election_results_post1971.csv I'll update the notebook to update the file path to this data set! |
Thanks! I downloaded that and put it in election_data/state_legislative and got past that error. Now it's dying with a different error:
|
I realized that was with the pip install gerrymetrics; but I tried pip uninstall gerrymetrics followed by pip install . from the checked-out code, and got the same error. If it matters, this virtualenv's pandas reports version 1.0.1 (Python version 3.7.5). |
Hi @akkana, I tried to reproduce your issue but was not able to do so. I created a virtual environment (python version 3.7.4) and successfully installed gerrymetrics just now. I wonder if your issue is coming up because your version of pandas does not agree with the version of pandas automatically installed by this package. What I recommend is that you create a virtual environment, and before installing any other packages, install gerrymetrics with the following code:
Let me know if that works, thanks so much! |
I get exactly the same error as before when I type those three lines followed by |
If I edit utils.py and put double underscores at eiither end of the "contains" in the line that's erroring (I can't illustrate that because apparently double underscores have a meaning in markdown) in parse_results(), I get a little farther and it even appears to download something (some data?), but then it dies with
(I should warn you my utils.py line numbers will be a little off because I've inserted some print()s). This is Python 3.7.5 on Ubuntu 19.10, so probably the pandas the virtualenv is pulling in is tied to that. pandas double-underscore version is 1.0.3. |
@akkana I just pushed some code that updates the pandas syntax and data path. Will you try cloning again with the updated code and run in a virtual environment with:
Thanks so much! |
Sorry for the delay, I've been super busy with election stuff. Following those instructions (after git pull in the gerrymandertests repo) gives this mysterious error:
It's mysterious because clearly scipy is there; if I run python inside the venv and run import scipy.stats as sps, it works fine. But it doesn't work inside the notebook. Aha: that's because Ubuntu's jupyter-notebook begins with: #!/usr/bin/python3.
Sure enough, that line is indented more than the lines before it. If I fix the indentation, I get a little farther:
so alas, now I'm just back to the error from two weeks ago. |
I'm trying to run the gerrymandertests, but apparently it relies on my separately downloading state-specific files (I'm particularly interested in New Mexico) and I can't find any documentation on where to get them.
If I just run the notebook, here's the error:
election_data/congressional_election_results_post1948.csv comes as part of the repository, but election_data/state_legislative/ is an empty directory. Where can I get the files that it expected there?
In NM we're actively fighting for better redistricting (I'm webmaster for fairdistrictsnm.org) and I'd love to get some quantitative measurements I could show to legislators and display on the website.
The text was updated successfully, but these errors were encountered: