How can I read tar.gz file using pandas read_csv with gzip compression option?

前端 未结 2 609
孤街浪徒
孤街浪徒 2020-12-10 00:54

I have a very simple csv, with the following data, compressed inside the tar.gz file. I need to read that in dataframe using pandas.read_csv.

   A  B
0  1          


        
2条回答
  •  旧巷少年郎
    2020-12-10 01:43

    df = pd.read_csv('sample.tar.gz', compression='gzip', header=0, sep=' ', quotechar='"', error_bad_lines=False)
    

    Note: error_bad_lines=False will ignore the offending rows.

提交回复
热议问题