Missing Values & NaN

If the data we have imported contains missing values, Pandas will go ahead and enter “NaN” into the cell for you. It’s up to you what you want to do with that “NaN”. Here is how to fill (replace) that data:

Use the function “fillna()” to fill in NaN values:

Dataframe.fillna(self, value = none, method = none, axis = none, inplace = false, limit = none, downcast = none)

I modified this for my scenario:

car_sales_missing[“Odometer”] = car_sales_missing[“Odometer”].fillna(car_sales_missing[“Odometer”].mean(),inplace=True)

  • Note on using inplace: boolean, default false — if true, fill in-place (this is the instruction to write over the NaN value).

Data Type error…

OK this part was slightly more challenging - a data type caused an error. But after scratching my head a while and doing some digging I was miraculously able to change the data types to what I needed! Here’s the error:

What the heck is Pandas? A cute high-fiving bear?

In this case, Pandas is a two-dimensional data-frame used in the Jupyter Environment

From the Anaconda Prompt explore and activate Conda:

conda env list

conda activate c:\users\Thund\desktop\sample_project_1\env

Jupyter notebook

Making a data frame from scratch:

Inside the Notebook, the interface is 1 blank horizontal cell with typical file menu options running atop. The cell can contain Code (python) or Markdown (text). The cell numbers are a history of executed code or markdown.

Different things I can do inside the Jupyter Notebook:

From the selected cell…

Hello World!

I am starting a new blog today. My goal with this new blog is to document my learning experiences as I explore the Data Science world. I will be periodically posting details of the problems I am trying to solve, technologies used, and datasets, along with associated results…

MORGAN KATZ

Business Analyst with an MBA in Business Intelligence. Machine learning student. Exploring data through analysis and solving problems using ML tools.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store