> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/data-science-lab-4/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bdb.ai/data-science-lab-4/repo-sync-project/tabs-for-a-data-science-lab-project/tabs-for-pyspark-environment/notebook/notebook-page/operations-for-an-.ipynb-file/datasets.md).

# Datasets

Now the Notebook page facilitates the user to add the datasets.

{% hint style="success" %}
*Check out the given walk-through on how to add a dataset using the .ipynb file.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FpD12l0BVjSUiiGm0sl7t%2FAdding%20a%20Dataset.mp4?alt=media&token=a63ad258-c7f1-403b-bdf8-878cfccdff8a>" %}
***Adding a Dataset to a .ipynb file***
{% endembed %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2F5DWlZo8ZZ2XZ1OIEc4vF%2FUploading%20and%20Adding%20a%20Data%20Sandbox.mp4?alt=media&token=d8737109-317a-4fc2-bafc-f00280b005c1>" %}
***Uploading a Datastore file, Adding it to a .ipynb file***
{% endembed %}

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The Datasets even if added from a .ipynb infrastructure, they get added at the project level, so the added Datasets are available for all the files under the the same project.*
{% endhint %}

## Adding Datasets

* Navigate to the Notebook page.
* Click the ***Datasets*** tab.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FZIxlyTY7aovivNOzqCVa%2Fimage.png?alt=media&amp;token=a6ef297d-537a-4c1e-bb11-4d5ab216947b" alt=""><figcaption></figcaption></figure>

* Click on the ***Add Dataset*** option.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2F1OMhg6mw317vNhNiswf8%2Fimage.png?alt=media&amp;token=cf90181d-ba63-4dd4-8531-7a003c50e6af" alt=""><figcaption></figcaption></figure>

* The ***Add Datasets*** page appears.&#x20;
* Select ***Data Sets*** or ***Data Sandbox*** option from the Data Source drop-down menu.
* Search for a Data Set using the search bar.
* Select dataset(s) as per the requirement using the check box. The user can select multiple datasets/ data sandbox.
* Click the ***Add*** option.&#x20;

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The Add option gets displayed only after you select at least one dataset.*
{% endhint %}

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FejAzLsMYkDfcToEhqsg6%2Fimage.png?alt=media&amp;token=e7851611-892e-41cd-871d-cb5c9afcf2f6" alt=""><figcaption><p><em><strong>The Add Datasets page</strong></em> </p></figcaption></figure>

* A notification message appears.
* The selected Dataset(s) get added to the given ***Datasets*** tab.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FgaLAN3OqS6HcYQwM0Dxt%2Fimage.png?alt=media&amp;token=f3fb5409-1584-4e4c-a1fe-e9cd4f57673d" alt=""><figcaption></figcaption></figure>

* Click on the ***More*** icon for an added Dataset.
* The drop-down menu appears displaying the ***Preview*** and ***Data Preparation*** actions for the added dataset appears.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2F505sTXHDnSueqGINqua8%2Fimage.png?alt=media&amp;token=ea64e68b-41a6-4d00-9d7e-e7f245873f74" alt=""><figcaption></figcaption></figure>

## Uploading Datasets (Data Sandbox)

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>  The **Upload** option is provided for the Sandbox files inside the Data Science Notebook.*
{% endhint %}

* Navigate to the ***Add Datasets*** panel from a Data Science Notebook.
* Select the ***Data Sandbox*** option as Data Source.
* Click the ***Upload*** option.

<figure><img src="https://content.gitbook.com/content/1QeOywZjV1cHo55cMW8u/blobs/K9UW63tc0JRsnVqC3raY/image.png" alt=""><figcaption></figcaption></figure>

* The ***Upload Data Sandbox*** window appears.
* Provide a Sandbox Name.
* Provide Description (it is optional).
* Use the ***Choose File*** option to select a file from the system.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2Fn8EAuTRLzSAAsh74s1Mo%2Fimage.png?alt=media&amp;token=1632700f-0c10-4d57-a685-0ff5212f34ed" alt=""><figcaption></figcaption></figure>

* Select a file from the system and upload.
* Once the selected file name appears next to the Choose File, click the ***Save*** option to upload the selected file.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FXvuOvQo78PUSv5eple6I%2Fimage.png?alt=media&amp;token=1acd8af4-9c80-48b7-b8f4-d102dccfba4b" alt=""><figcaption></figcaption></figure>

* A notification message appears to inform completion of the action.
* The uploaded file lists below with a checkbox to select it.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FBI2wZD3h5iIhYZuvkjJ2%2Fimage.png?alt=media&amp;token=458ee13d-d6e0-46c5-ac6a-efdc07d23a3c" alt=""><figcaption></figcaption></figure>

* Select the File using the checkbox.
* Click the ***Add*** option.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FtL26I1Vcc58xM3V5TqDX%2Fimage.png?alt=media&amp;token=dafbfa21-1c47-46da-919a-ae220a64f8a0" alt=""><figcaption></figcaption></figure>

* A notification message appears.
* The uploaded Data Sandbox dataset gets added to the Notebook.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2Fh0GFgxNaHCDS4ofyEVFG%2Fimage.png?alt=media&amp;token=511b6088-a6fb-4bc3-9146-ac60f1b3fd6a" alt=""><figcaption></figcaption></figure>

## ​Reading Datasets

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> Using **get\_data** function datasets and data sandbox files (csv & xlsx files) can be read.*
{% endhint %}

* Add a new Code cell to Notebook or access an empty Code cell.
* Select a dataset from the Datasets tab.
* The ***get\_data*** function appears in the code cell.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FnHdbaVzbuODnvISnvC2I%2Fimage.png?alt=media&amp;token=49db9aae-cabc-4542-8e2b-7380bd6e9533" alt=""><figcaption></figcaption></figure>

* Select the df from the get\_data function of the dataset.
* Add a code cell below.
* Provide the df to display the data from the selected Dataset using the show function.
* Run all the cells.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FcWHZ9160TFfD2agsMvDU%2Fimage.png?alt=media&amp;token=e8087295-a99b-4e86-ae33-97213f5d5e46" alt=""><figcaption></figcaption></figure>

* The Data preview appears below. It will display 20 rows by default.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2Ff6IU64q5PxG5T6UogXia%2Fimage.png?alt=media&amp;token=96d3d843-abe4-48a6-83cd-d101b1dc67a8" alt=""><figcaption></figcaption></figure>

* The user can insert the number of rows to get the preview of the data up to that limit.

<figure><img src="https://4082649235-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QeOywZjV1cHo55cMW8u%2Fuploads%2FBBGS0ZNqlqa7yz40mGMz%2Fimage.png?alt=media&amp;token=57d01f0c-3303-4a1d-8418-70a97dd5c294" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*&#x20;

* The Text files added as Datasets to a Notebook will be disabled for the data load function. Only Copy Path option will be provided for such datasets.
* *Refer the* [***Data Science Lab Quick Start Flow***](https://docs.bdb.ai/data-science-lab-4/data-science-lab-quick-start-flow) *page to get an overview of the **Data Science Lab** module in nutshell.*&#x20;
  {% endhint %}
