How to import data from Kaggle without downloading it?

WBOY
Release: 2024-02-05 23:42:11
forward
1099 people have browsed it

如何在不下载数据的情况下从 Kaggle 导入数据?

Question content

I want to import data from kaggle into my notebook without having to download it (so if I share my .ipynb, You just have to run the code and it will download it from the internet) but I don't know if it is possible and which link to copy. This is the kaggle website:

https://www.kaggle.com/datasets/kukuroo3/body-performance-data/data?select=bodyperformance.csv

data = pd.read_csv('link here')
Copy after login

I tried copying the download button link but it doesn't work and shows: parsererror: Error while marking data. c Error: Line 9 should have 1 field but saw 2


Correct answer


First approach

You can go to the dataset page and click New Notebook in the upper right corner

The second method

Open any notebook and click "Add Data" in the right menu

The third method

Not recommended because everyone who opens ipynb must first upload their own token.

When using colab, first download your kaggke json key and perform the following steps

  • To create a kaggle key, you can go into your settings and then into the accounts tab, you can find the Create new token button in the api section, click on it to download your token.
  • Install kaggle library
! pip install  kaggle
Copy after login
  • Upload your kaggle key, or you can enter the following code to upload the key
from google.colab import files
files.upload()
Copy after login
  • Now you can download the dataset using the following code
!kaggle datasets download -d [user/data-name]
Copy after login

In our example, [user/data-name] is kukuroo3/body-performance-data

The above is the detailed content of How to import data from Kaggle without downloading it?. For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!