When you're starting your Machine Learning journey, one of the first things you'll need to learn is how to load your dataset into your Jupyter Notebook.
Let's learn how to do it in the simplest way. π
π Step 1: Import Pandas
import pandas as pd
Here, we're importing the Pandas library and giving it the shorter name pd.
Pandas is a popular Python library used for data analysis and manipulation. It provides useful tools for working with structured data such as CSV files.
π Step 2: Load the Dataset
df = pd.read_csv("Dataset.csv")
Let's break this line down:
πΉ pd β The alias we gave to Pandas.
πΉ read_csv()
β A Pandas function used to read data from a CSV file.
πΉ "Dataset.csv" β The path or filename of our dataset.
πΉ df β A variable that stores the resulting Pandas DataFrame.
A DataFrame is basically a table of rows and columns that makes it easier to work with our dataset.
You can also load a CSV using a URL:
df = pd.read_csv("https://example.com/dataset.csv") π** Step 3: Take a Quick Look at Your Data**
After the dataset, you can check the first few rows:
df.head()
This is a very useful first step because it lets you quickly understand what your dataset looks like.
π‘ In short:
import pandas as pd
`df = pd.read_csv("Dataset.csv")`
df.head()
That's it! π
You've successfully loaded your dataset into a Jupyter Notebook and can now start exploring and preprocessing your data.
I'm also learning these concepts while building my final-year Machine Learning project, so I'll continue sharing what I learn along the way.
If you're also learning Python or Machine Learning, feel free to share your questions in the comments. π See you in the next lesson! π