Back to Browse

Python for Machine Learning | How to manipulate NAN (Not a number) - P5

4.1K views
Dec 5, 2017
10:17

Python for Machine Learning - Part 5 - How to manipulate NAN (Not a number) In this video I will show how to deal with NAN(not a number) in python Pandas and Series. Topics to be covered - How to Handle Missing Values Code Starts Here ============== import pandas as pd import numpy as np Series1 = pd.Series([7,6.8,'Avengers',np.nan,'Apple']) isnull() and notnull() both the above functions return Boolean ( True or False) Series1.isnull().sum() Series1.notnull().sum() dataset = pd.read_csv('train.csv') dataset['Age'].notnull().sum() dataset[dataset['Age'].notnull()].head() What happens if we try to replace some value with nan? dataset['Sex'] = dataset['Sex'].replace('female',np.nan)

Download

0 formats

No download links available.

Python for Machine Learning | How to manipulate NAN (Not a number) - P5 | NatokHD