the data collected may also be inconsistent with other records collected over time the existence of duplicate entries and incomplete records warrant that we treat the data in such way as to bring out hidden and buried treasure the raw data may also be shrouded in sea of irrelevant data to clean the data upwe can totally discard irrelevant databetter known as noise data with missing parts or attributes can be replaced with sensible estimates alsowhere the raw data suffers from inconsistencydetecting and correcting them becomes necessary let us explore how we can use numpy and pandas for data preprocessing techniques missing data data collection is tedious andas suchonce data is collectedit should not be easily discarded just because dataset has missing fields or attributes does not mean it is not useful several methods can be used to fill up the nonexistent parts one of these methods is by either using global constantusing the mean value in the datasetor supplying the data manually the choice is based on the context and sensitivity of what the data is going to be used for takefor instancethe following dataimport numpy as np data pandas dataframe([ ][np nannp nan ][ ]]as we can seethe data elements data[ ][ and data[ ][ have values being np nanrepresenting the fact that they have no value if the np nan values are undesired in given datasetthey can be set to some constant figure let' set data elements with the value np nan to print(data fillna( )the new state of the data becomes the following