ENH: more perf fixes. uses masks when possible in df.to_csv