r/pythonhelp • • Nov 23 '21

HOMEWORK Trouble importing CSV into google collab

Hello, I have to do a coding project which I need to upload in a couple of days.

For the meantime I have been using this method to import the csv file from my laptop.

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

and then select the file from my computer.

But I don't think I can do this when I actually need to download and then upload my project to be graded.

If it helps I got the CSV file from this link, is there a way I can maybe import it from online?

https://www.kaggle.com/harti28/independence-and-interdependence-in-sports

Sorry if this is simple, I don't really understand what it is saying online when I research it.

6 Upvotes

3 comments sorted by

2

u/Goobyalus Nov 23 '21

I'm not super familiar with Colab, but what are you uploading to? Are there requirements for what you upload?

If it's trough Colab I would think you can just upload the CSV with the project, it's just a matter of referring to it properly in the script portion.

1

u/ladyjane345 Nov 24 '21

Thank you for responding! What I ended up doing was uploading it to a public github then importing it from there which has worked :)

2

u/MT1961 Nov 24 '21

I would ask the professor, but I *think* what you are supposed to do here is give the file as input to your program. If you know how to work with command line arguments by now, this is likely how the prof wanted it done. Again, I'd check with them, I don't think the intent here was for you to download it from the Internet in your app.