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

warning_bad_lines #62

Open
egodat opened this issue Nov 1, 2021 · 0 comments
Open

warning_bad_lines #62

egodat opened this issue Nov 1, 2021 · 0 comments

Comments

@egodat
Copy link

egodat commented Nov 1, 2021

In hist3368-week5-plotting-change-over-time/hist3368-week5-access-data.ipynb, there is a typo. Under the US Congress heading in the read_csv function the argument warning_bad_lines should be warn_bad_lines.

The code should be:

import pandas as pd
import csv
import glob

directory = '/scratch/group/oit_research_data/stanford_congress/hein-bound/'
file_type = 'txt'
delim ='|'

speeches_df = pd.concat([pd.read_csv(f, sep=delim, encoding="ISO-8859-1", error_bad_lines=False, warn_bad_lines = False, quoting=csv.QUOTE_NONE) 
                         for f in glob.glob(directory + "speeches_*"+file_type)])

descr_df = pd.concat([pd.read_csv(f, sep=delim, encoding="ISO-8859-1", error_bad_lines=False, warn_bad_lines = False, quoting=csv.QUOTE_NONE) 
                      for f in glob.glob(directory + "descr_*"+file_type)])

all_congressional_data = pd.merge(speeches_df, descr_df, on='speech_id').fillna(0)
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

1 participant