Loading a Dataset Locally

Loading local files

Other than loading a dataset using a URL, we can also load a dataset within the same directory or folder as the working file. For example, we can quickly load the dataset iris.csv inside the working file, main.py, if both are within the same directory. We can also load the dataset if it's located elsewhere locally.

In addition, unlike earlier when we used the head() function to preview the dataset records, we can use the sample() function to retrieve a representative random sample of records from the dataset.

Get hands-on with 1200+ tech skills courses.