avatarJ3

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

2900

Abstract

edium.com/v2/resize:fit:800/1*MbLZTSgh1HyXWNdCb7GdPg.png"><figcaption></figcaption></figure><div id="5166"><pre>df.fillna(value <span class="hljs-operator">=</span> “Fill Value”)</pre></div><figure id="5017"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*RCoFff4y7hwcf5ylxbMVhw.png"><figcaption></figcaption></figure><p id="610a">Or to the mean of the column</p><div id="33e6"><pre>df<span class="hljs-selector-attr">[‘A’]</span><span class="hljs-selector-class">.fillna</span>(value=df<span class="hljs-selector-attr">[‘A’]</span><span class="hljs-selector-class">.mean</span>())</pre></div><figure id="141f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*MMaCsXxqLg-gyvVestJUUg.png"><figcaption></figcaption></figure><div id="0ecb"><pre><span class="hljs-function"><span class="hljs-title">print</span><span class="hljs-params">(“Thank you for Reading This post! See you soon! Bye o/”)</span></span></pre></div><p id="72ff">Colab File <a href="https://colab.research.google.com/drive/1w4WHjRrn20efow15nKNtKZK_im136s2T?usp=sharing">link</a>:)</p><h1 id="c9a5">Posts Related:</h1><p id="3ff7">00Episode#<b>PySeries </b>— Python — <a href="https://medium.com/@J.3/python-jupiter-notebook-quick-start-with-vscode-916c43c10d9a">Jupiter Notebook Quick Start with VSCode — How to Set your Win10 Environment to use Jupiter Notebook</a></p><p id="0f9b">01Episode#<b>PySeries </b>— Python — <a href="https://readmedium.com/python-for-engenniging-exercises-977fbe4d6d02">Python 4 Engineers — Exercises! An overview of the Opportunities Offered by Python in Engineering!</a></p><p id="76e7">02Episode#<b>PySeries </b>— Python — <a href="https://readmedium.com/geogebra-plus-linear-programming-a51661c99590">Geogebra Plus Linear Programming- We’ll Create a Geogebra program to help us with our linear programming</a></p><p id="623f">03Episode#<b>PySeries</b> — Python — Python 4 Engineers — More Exercises! — Another Round to Make Sure that Python is Really Amazing!</p><p id="fdc6">04Episode#<b>PySeries</b> — Python — <a href="https://readmedium.com/linear-regressions-the-basics-1a633f351ec2">Linear Regressions — The Basics — How to Understand Linear Regression Once and For All!</a></p><p id="2a48">05Episode#<b>PySeries</b> — Python — <a href="https://readmedium.com/numpy-init-python-review-f5362abbaaf9">NumPy Init & Python Review — A Crash Python Review & Initialization at NumPy lib.</a></p><p id="fd74">06Episode#<b>PySeries</b> — Python — <a href="https://readmedium.com/numpy-jupyter-notebook-1182f78ab4e1">NumPy Arrays & Jupyter Notebook — Arithmetic Operations, Indexing & Slicing, and Conditional Selection w/ np arrays</a>.</p><p id="16ae">07Episode#<b>PySeries</b> — Python — <a href="https://readmedium.com/pandas-intro-series-970e206e2ad5">Pandas — Intro & Series — What it is? How to use it?</a></p><p id="f047">08Episode#<b>PySerie

Options

s</b> — Python — <a href="https://readmedium.com/pandas-dataframes-7ba872dcbc30">Pandas DataFrames — The primary Pandas data structure! It is a dict-like container for Series objects</a></p><p id="7d1b">09Episode#<b>PySeries</b> — Python — <a href="https://readmedium.com/python-4-engineers-even-more-exercises-d0141e0b06d">Python 4 Engineers — Even More Exercises! — More Practicing Coding Questions in Python!</a></p><p id="bd27">10Episode#<b>PySeries</b> — Python — <a href="https://readmedium.com/pandas-hierarchical-index-cross-section-30783023a274">Pandas — Hierarchical Index & Cross-section — Open your Colab notebook and here are the follow-up exercises!</a></p><p id="ba42">11Episode#<b>PySeries</b> — Python — Pandas— Missing Data — Let’s Continue the Python Exercises — Filling & Dropping Missing Data (this one:)</p><p id="8842">12Episode#<b>PySeries</b> — Python — <a href="https://readmedium.com/pandas-group-by-3140d053b9c">Pandas — Group By — Grouping large amounts of data and compute operations on these groups</a></p><p id="3700">13Episode#<b>PySeries</b> — Python — <a href="https://readmedium.com/pandas-merging-joining-concatenations-a35bbe1a9dd5">Pandas — Merging, Joining & Concatenations — Facilities For Easily Combining Together Series or DataFrame</a></p><p id="238c">14Episode#<b>PySeries</b> — Python — <a href="https://readmedium.com/pandas-operations-4b8f7a4b4139">Pandas — Pandas Dataframe Examples: Column Operations</a></p><p id="af46">15Episode#<b>PySeries</b> — Python — <b>Python 4 Engineers </b>— Keeping It In The Short-Term Memory — <a href="https://readmedium.com/python-4-engineers-keeping-it-in-the-short-term-memory-4f9458016171"><b>Test Yourself!</b> Coding in Python, Again!</a></p><p id="aa0c">16Episode#<b>PySeries</b> — NumPy — <a href="https://readmedium.com/numpy-review-again-f94f1c1c77e8">NumPy Review, Again;)<b> </b></a>— Python Review Free Exercises</p><p id="08cb">17Episode#<b>PySeries</b><a href="https://readmedium.com/generators-in-python-8d3de173743e">Generators in Python<b></b></a><b><a href="https://readmedium.com/numpy-review-again-f94f1c1c77e8"><b> </b></a>— Python Review Free Hints</b></p><p id="c414">18Episode#<b>PySeries</b> — P<a href="https://readmedium.com/panda-review-again-baf0687b35de">andas Review…Again;)</a> — Python Review Free Exercise</p><p id="4e78">19Episode#<b>PySeries</b><a href="https://readmedium.com/matlibplot-seaborn-python-libs-459f6666f35f">MatlibPlot & Seaborn Python Libs </a>— Reviewing theses Plotting & Statistics Packs</p><p id="f0aa">20Episode#<b>PySeries</b><a href="https://readmedium.com/seaborn-python-review-9e543b6b7a44">Seaborn Python Review</a> — Reviewing theses Plotting & Statistics Packs</p><figure id="445b"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*VkjzHOmzoo6aFCju.png"><figcaption></figcaption></figure></article></body>

Pandas — Missing Data

Let’s Continue the Python Exercises — Filling & Dropping Missing Data — #PySeries#Episode 11

Open your Colab notebook and here are the follow-up exercises!

print(“Hello Pandas — Missing Data!”)

Preparing DataFrame:

import numpy as np
import pandas as pd
d = {'A':[1,2, np.nan], 'B':[5, np.nan, np.nan], 'C':[1,2,3]}
df = pd.DataFrame(d)
Row ‘0’ has no missing Values, and Column ‘C’ has no missing values
df
## Dropping Rows w/ Missing Values (dropna)
df.dropna()

Dropping Columns w/ Missing Values

df.dropna(axis=1)

Specifying a Threshold

# If We set the threshold to be equal to 2 and run 
# this will went ahead and kept row 1 and 2, 
# because it has a maximum of 2 Nan values
df.dropna(thresh=2)

Filling in Missing Values (fillna)

# Again, here is my DF:
df
df.fillna(value = “Fill Value”)

Or to the mean of the column

df[‘A’].fillna(value=df[‘A’].mean())
print(“Thank you for Reading This post! See you soon! Bye o/”)

Colab File link:)

Posts Related:

00Episode#PySeries — Python — Jupiter Notebook Quick Start with VSCode — How to Set your Win10 Environment to use Jupiter Notebook

01Episode#PySeries — Python — Python 4 Engineers — Exercises! An overview of the Opportunities Offered by Python in Engineering!

02Episode#PySeries — Python — Geogebra Plus Linear Programming- We’ll Create a Geogebra program to help us with our linear programming

03Episode#PySeries — Python — Python 4 Engineers — More Exercises! — Another Round to Make Sure that Python is Really Amazing!

04Episode#PySeries — Python — Linear Regressions — The Basics — How to Understand Linear Regression Once and For All!

05Episode#PySeries — Python — NumPy Init & Python Review — A Crash Python Review & Initialization at NumPy lib.

06Episode#PySeries — Python — NumPy Arrays & Jupyter Notebook — Arithmetic Operations, Indexing & Slicing, and Conditional Selection w/ np arrays.

07Episode#PySeries — Python — Pandas — Intro & Series — What it is? How to use it?

08Episode#PySeries — Python — Pandas DataFrames — The primary Pandas data structure! It is a dict-like container for Series objects

09Episode#PySeries — Python — Python 4 Engineers — Even More Exercises! — More Practicing Coding Questions in Python!

10Episode#PySeries — Python — Pandas — Hierarchical Index & Cross-section — Open your Colab notebook and here are the follow-up exercises!

11Episode#PySeries — Python — Pandas— Missing Data — Let’s Continue the Python Exercises — Filling & Dropping Missing Data (this one:)

12Episode#PySeries — Python — Pandas — Group By — Grouping large amounts of data and compute operations on these groups

13Episode#PySeries — Python — Pandas — Merging, Joining & Concatenations — Facilities For Easily Combining Together Series or DataFrame

14Episode#PySeries — Python — Pandas — Pandas Dataframe Examples: Column Operations

15Episode#PySeries — Python — Python 4 Engineers — Keeping It In The Short-Term Memory — Test Yourself! Coding in Python, Again!

16Episode#PySeries — NumPy — NumPy Review, Again;) — Python Review Free Exercises

17Episode#PySeriesGenerators in Python — Python Review Free Hints

18Episode#PySeries — Pandas Review…Again;) — Python Review Free Exercise

19Episode#PySeriesMatlibPlot & Seaborn Python Libs — Reviewing theses Plotting & Statistics Packs

20Episode#PySeriesSeaborn Python Review — Reviewing theses Plotting & Statistics Packs

Pandas
Pandas Dataframe
Pandas Filling Data
Dropping Missing Data
Numpy
Recommended from ReadMedium