I am trying to truncate data from a csv file that i got from the interwebs using python

111 views
Skip to first unread message

Shriman Sonti

unread,
Dec 29, 2016, 9:15:30 PM12/29/16
to PyData
I have a code that downloads a csv file from a website, but it won't download this specific csv file because it has some missing spaces in the file 

This is my code:
    import requests
    import pandas as pd
    from io import StringIO
    outfile = r'C:\Users\spkso\Desktop\out\myfile.csv'

    csv = requests.get(url)



    df = pd.read_csv(StringIO (csv.text))

   df.to_csv(outfile)

Any suggestions would be much obliged 
Thank You

    

Paul Hobson

unread,
Dec 31, 2016, 11:32:15 AM12/31/16
to pyd...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "PyData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pydata+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages