How to load a dataset from another website using a the website link

please help,i have a datasets on kaggle which needed to be load into my julia environment without downloading the dataset directly.

https://stackoverflow.com/questions/24229984/reading-data-from-url

I like the second answer most, REPL help:

help?> download
search: download

  download(url::AbstractString, [path::AbstractString = tempname()]) -> path

  Download a file from the given url, saving it to the location path, or if not specified, a temporary path. Returns the path of the downloaded file.

  β”‚ Note
  β”‚
  β”‚  Since Julia 1.6, this function is deprecated and is just a thin wrapper around Downloads.download. In new code, you should use that function directly instead of calling this.

Another note: for smaller data sets there is also readdlm which works without DataFrames

julia> using DelimitedFiles

help?> DelimitedFiles.readdlm
  readdlm(source, T::Type; options...)

  The columns are assumed to be separated by one or more whitespaces. The end of line delimiter is taken as \n.

  Examples
  ≑≑≑≑≑≑≑≑≑≑

  julia> using DelimitedFiles
  
  julia> x = [1; 2; 3; 4];
  
  julia> y = [5; 6; 7; 8];
  
  julia> open("delim_file.txt", "w") do io
             writedlm(io, [x y])
         end;
  
  julia> readdlm("delim_file.txt", Int64)
  4Γ—2 Matrix{Int64}:
   1  5
   2  6
   3  7
   4  8
[...]  

what sort of indirect download are you imagining ?

@Matt , what I mean is ,I don’t want to download the dataset on my PC/system before importing it on notebook.

I want to import/load the dataset directly from the website into the notebook.

The HTTP client library is

https://juliaweb.github.io/HTTP.jl/stable/

once you have a connection, you can treat it like a regular IO object

1 Like