I try to get data from google speed sheet
from __future__ import print_function
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
import pandas as pd
import numpy as np
from numpy import nan
import json
I do
SCOPE = ["https://spreadsheets.google.com/feeds"]
SECRETS_FILE = "D:.......json"
SPREADSHEET = "sheet"
and
json_key = json.load(open(SECRETS_FILE))
credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], SCOPE)
gc = gspread.authorize(credentials)
workbook = gc.open(SPREADSHEET)
sheet = workbook.sheet1
db = pd.DataFrame(sheet.get_all_records())
db.head()
and I get
----> 6 db = pd.DataFrame(sheet.get_all_records())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 2039: invalid continuation byte
I tried
import sys
from importlib import reload
reload(sys)
sys.setdefaultencoding("utf-8")
AttributeError: module 'sys' has no attribute 'setdefaultencoding'
I use
print (sys.version)
3.5.4 |Anaconda custom (64-bit)| (default, Aug 14 2017, 13:41:13) [MSC v.1900 64 bit (AMD64)]
And I tried
import os
os.environ["PYTHONIOENCODING"] = "utf-8"
with no result. I guess the problem can be in that I updated version Python