Convert text data from requests object to dataframe with pandas

后端 未结 4 955
离开以前
离开以前 2021-02-05 10:31

Using requests I am creating an object which is in .csv format. How can I then write that object to a DataFrame with pandas?

To get the requests object in text format:

4条回答
  •  青春惊慌失措
    2021-02-05 10:52

    Try this

    import requests
    import pandas as pd
    import io
    
    urlData = requests.get(url).content
    rawData = pd.read_csv(io.StringIO(urlData.decode('utf-8')))
    

提交回复
热议问题