dalejn / cleanBib

Probabilistically assign gender and race proportions of first/last authors pairs in bibliography entries
MIT License
149 stars 31 forks source link

Error color coding .tex file #26

Closed allisonmorgan closed 1 year ago

allisonmorgan commented 3 years ago

Thank you for this package! I am hitting an error on the final line of cleanBib.ipynb (stack trace below). I am running the code inside a Binder and have placed my .aux, .tex, and .bib files in the same folder as the notebook.

Is there a Jupyter notebook missing (getReferenceGends.ipynb), or should the Authors.csv file be generated in one of the earlier lines of cleanBib.ipynb? Happy to troubleshoot or submit a pull request if it is a quick fix!

Thanks in advance and hope I am not missing something here!

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-6-0a59cf3d4a86> in <module>
----> 1 cite_gender = pd.read_csv(homedir+'Authors.csv') # output of getReferenceGends.ipynb
      2 cite_gender.index = cite_gender.CitationKey
      3 cite_gender['Color'] = '' # what color to make each gender category
      4 colors = {'MM':'red','MW':'blue','WW':'green','WM':'magenta','UU':'black',
      5 'MU':'black','UM':'black','UW':'black','WU':'black'}

/srv/conda/envs/notebook/lib/python3.7/site-packages/pandas/io/parsers.py in read_csv(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)
    684     )
    685 
--> 686     return _read(filepath_or_buffer, kwds)
    687 
    688 

/srv/conda/envs/notebook/lib/python3.7/site-packages/pandas/io/parsers.py in _read(filepath_or_buffer, kwds)
    450 
    451     # Create the parser.
--> 452     parser = TextFileReader(fp_or_buf, **kwds)
    453 
    454     if chunksize or iterator:

/srv/conda/envs/notebook/lib/python3.7/site-packages/pandas/io/parsers.py in __init__(self, f, engine, **kwds)
    944             self.options["has_index_names"] = kwds["has_index_names"]
    945 
--> 946         self._make_engine(self.engine)
    947 
    948     def close(self):

/srv/conda/envs/notebook/lib/python3.7/site-packages/pandas/io/parsers.py in _make_engine(self, engine)
   1176     def _make_engine(self, engine="c"):
   1177         if engine == "c":
-> 1178             self._engine = CParserWrapper(self.f, **self.options)
   1179         else:
   1180             if engine == "python":

/srv/conda/envs/notebook/lib/python3.7/site-packages/pandas/io/parsers.py in __init__(self, src, **kwds)
   2006         kwds["usecols"] = self.usecols
   2007 
-> 2008         self._reader = parsers.TextReader(src, **kwds)
   2009         self.unnamed_cols = self._reader.unnamed_cols
   2010 

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.__cinit__()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()

FileNotFoundError: [Errno 2] No such file or directory: '/home/jovyan/Authors.csv'
dalejn commented 3 years ago

Hi Allison, sorry about the delayed response. First, thanks for using the tool and for pointing out this error! We broke this in a recent update that changed how the outputs are saved (now in predictions.csv instead of Authors.csv). We'll fix this in this next update by either wrangling the same data from predictions.csv in that last section of code, or recreating the relevant columns and saving it locally to Authors.csv. If you'd like to try submitting a pull request, we'd be appy to troubleshoot with you. Authors.csv used to look like: https://www.dropbox.com/s/4wtm3bepcodwunj/Authors.csv?dl=0

If you want to try out the color-coding from a previous commit and have some spare genderAPI credits, you could launch Binder from: https://mybinder.org/v2/gh/dalejn/cleanBib/7ffe1823397a77c8c068b549c7b428c79379232e

allisonmorgan commented 3 years ago

No worries @dalejn! I'd like to give it a try. It might take me until the end of the week to get a PR together. I'll ping you if I hit any roadblocks, or when I have it ready for your eyes. Thanks for the help troubleshooting.