Skip to main content

layer.get_dataset

get_dataset()

  • Parameters

    • name (str) -- Name or path of the dataset.
    • no_cache (bool) -- if True, force dataset fetch from the remote location.
  • Returns

    A dataset object defined in a Layer project.

Retrieves a Layer dataset object from the Discover > Datasets tab.

Guest users can use this function to access public datasets without logging in to Layer.

By default, this function caches dataset contents locally when possible.

# The simplest application of this method just returns a list of dataset information.
layer.get_dataset("titanic")

# This example gets the titanic dataset, turns it into a Pandas dataframe, and then displays it.
dataset = layer.get_dataset("titanic")
df = dataset.to_pandas()
df.head()

# You can also get datasets from other projects you have access to, including public projects.
layer.get_dataset("the-project/datasets/titanic")