TSV(Tab separated Value) extension file can't be uploaded to google colab using pandas

Used this to upload my file

import io
df2 = pd.read_csv(io.BytesIO(uploaded['Filename.csv']))

import io
stk = pd.read_csv(io.BytesIO(uploaded['train.tsv']))

What i want is a tsv file should be uploaded and read into the dataframe stk


1 Answer 1


You first need to upload your file. The io.BytesIO only reads from the uploaded. So first run:

from google.colab import files
uploaded = files.upload()

and select the file you would like to upload.

Also, when you load it into your pandas, you need the sep='\t':

tsk = pd.read_csv(io.BytesIO(uploaded['train.tsv']), sep='\t')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.