Github CSV file read incorrectly

0

I have the following code to request CSV data from Github.

r = requests.get(
        'https://api.github.com/repos/{owner}/{repo}/contents/{path}'.format(
            owner=owner, repo=repo, path=path),
        headers={
            'accept': 'application/vnd.github.v3.raw',
            'authorization': 'token {}'.format(token)
        }
    )

   
    string_io_obj = StringIO(r.text)

   
    df = pd.read_csv(string_io_obj, sep=",", index_col=0)


    df.to_csv('temp.csv')

Here is the raw data from Github:

[0],['08:40'],"['08:40', '08:40', '08:40']",08:40,"[0, 0, 0]",0,0,94.9,94.9,0,0,0,21.3,0,0,0,0,0,0,0,0,0,0,0.5,0,1

and here is the requested data saved to temp file:

[0],['08:40'],"['08:40', '08:40', '08:40']",08:40,"[0, 0, 0]",0,0.1,94.9,94.9.1,0.2,0.3,0.4,21.3,0.5,0.6,0.7,0.8,0.9,0.10,0.11,0.12,0.13,0.14,0.5.1,0.15,1

Some of the data is wrong and other data points are non-sensical data such as “0.5.1”

Any ideas what may be happening or how to fix it? This does not alway occur but when it does, it’s quite frustrating as I now have wrong data and sometimes non-sensical data that I cannot work with.
Update: When I read the pulled data as a text file:

print(r.text)

The data is correct! So the error must be in the subsequent conversions to StringIo object, df and finally to df.to_csv. Is there a way to convert the r.text to a CSV directly?