Using Airflow, we're exporting data from Google Cloud SQL to a CSV, and eventually loading that CSV into a different SQL warehouse. However, Cloud SQL exports null values as the string "N (This is a known Google issue: https://issuetracker.google.com/issues/64579566). As an interim step, we need to open up the file and delete the "N. There are also actual strings in the csv, using " normally.
Ideally, we'd be able to do this with pandas - we're setup to use a DataFrame for the next step. However, I can't get read_csv to interpret the "N as nulls. Here's the basic command I've tried:
df = pd.read_csv(filepath, na_values='"N')
I've also tried na_values="\"N", but that gave me the same results.
It appears that read_csv checks for strings first, and for nulls second, so I'm getting output that looks like this:
Id 100
IncidentDate 2018-08-29 07:00:00
StudentInvolved Psueudonym
IncidentLocation Classroom
IncidentCategory Academic dishonesty
IncidentDescriptionDetails [TESTING] How does this insert into table when...
FollowUp 0
ConsequenceGiven Afterschool Academy
ConsequenceStartDate N,N
ConsequenceEndDate N,N
PrimaryViolation <email address>
Weapon <school_name>
CreatedBy N,N
SiteName 1000
DisciplinaryActionAuthority N,0,N
DocumentationUrl N,N
SIS_ID N,N
SubmittedBy N,N
Deleted N,N
FollowUpNotes N,N
StudentLists_fk N,N
Any ideas on if read_csv is capable of parsing this?