0
$\begingroup$

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

$\endgroup$

1 Answer 1

2
$\begingroup$

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')
$\endgroup$

Your Answer

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

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