简体   繁体   中英

Import Excel file to pandas from Github repository

In my effort to export Excel file in my private Github repository to Pandas data frame using the source code below:

username= 'xxx'
token = 'yyyy'
github_session = requests.Session()
github_session.auth = (username, token)

url = 'correct path to raw file'
export = requests.get(url).content

df = pd.read_excel(io.StringIO(export.decode('utf-8')))

I have encountered an error while running the last line of the above chunk:

TypeError: unsupported operand type(s) for <<: 'str' and 'int'

The Excel raw data file from Github repository has combined numeric and string records.

Excel is a binary file format. Use io.BytesIO(export) instead

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM