[Data science memorandum] Handling of missing values ​​[python]

Check for missing values.

Use the ** isnull () ** function. Variable to which DataFrame is assigned .isnull () True if missing values ​​are included, False otherwise.

Check the number of missing values

Use the ** isnull () ** and ** sum () ** functions. Variable to which DataFrame is assigned .isnull (). Sum ()

Delete missing values

Use the ** dropna () ** function. Variable to which DataFrame is assigned.dropna () After using the ** dropna () ** function, assign it to another variable or add the ** dropna ** argument replace = True, and rewrite the variable as it is when executed.

  1. data = data.dropna()
  2. data.dropna(inplace=True)
  3. data = data.dropna(inplace=True)

If you want to delete data where a particular column contains missing values DataFrame.dropna (subset = ['column name'])

Missing value completion

The ** fillna () ** function fills a missing value in a particular column with a value. Variable to which DataFrame is assigned ['column']. Fillna (value)

Fill in the missing values ​​with the mean of a particular column. Variable to which DataFrame is assigned ['column']. Mean ()

Recommended Posts

[Data science memorandum] Handling of missing values ​​[python]
[Data science memorandum] Confirmation of the contents of DataFrame type [python]
Python: Preprocessing in machine learning: Handling of missing, outlier, and imbalanced data
[Python] Chapter 02-06 <Supplement> Basics of Python programs (handling of numerical values)
Python --Check type of values
python> Handling of 2D arrays
Handling of python on mac
Comparison of data frame handling in Python (pandas), R, Pig
Handling of sparse tree-structured attributes (Python)
Python Application: Data Handling Part 3: Data Format
[Python] A memorandum of beautiful soup4
Memorandum of beginners Python "isdigit" movement
Data handling 2 Analysis of various data formats
Python memorandum
Python Memorandum 2
"Data Science 100 Knock (Structured Data Processing)" Python-007 Explanation
"Data Science 100 Knock (Structured Data Processing)" Python-006 Explanation
Memorandum of python beginners About inclusion notation
"Data Science 100 Knock (Structured Data Processing)" Python-001 Explanation
I took Udemy's "Practical Python Data Science"
Search / Delete Missing Values in "Kaggle Memorandum"
Data handling
Python memorandum
"Data Science 100 Knock (Structured Data Processing)" Python-002 Explanation
python memorandum
python memorandum
Recommendation of Altair! Data visualization with Python
[Python] Data Science 100 Knock (Structured Data Processing) 021 Explanation
"Data Science 100 Knock (Structured Data Processing)" Python-004 Explanation
[Python] Various combinations of strings and values
Python memorandum
python memorandum
[Python] Data Science 100 Knock (Structured Data Processing) 020 Explanation
Python memorandum
[Python] Data Science 100 Knock (Structured Data Processing) 025 Explanation
"Data Science 100 Knock (Structured Data Processing)" Python-003 Explanation
[Introduction to Data Scientists] Basics of Python ♬
[Python] Data Science 100 Knock (Structured Data Processing) 019 Explanation
A memorandum of python string deletion process
A memorandum of trouble when formatting data
[Python] 100 knocks on data science (structured data processing) 018 Explanation
[Python] 100 knocks on data science (structured data processing) 023 Explanation
[Python] 100 knocks on data science (structured data processing) 030 Explanation
[Python] 100 knocks on data science (structured data processing) 022 Explanation
A memorandum of calling Python from Common Lisp
[Python] Takes representative values ​​of multiple images [Numpy]
Real-time visualization of thermography AMG8833 data in Python
I summarized one year of self-taught data science.
A memorandum of extraction by python bs4 request
A story stuck with handling Python binary data
[Python] 100 knocks on data science (structured data processing) 017 Explanation
The story of reading HSPICE data in Python
[Python] 100 knocks on data science (structured data processing) 024 Explanation
[Introduction to cx_Oracle] (5th) Handling of Japanese data
Python introductory study-output of sales data using tuples-
Python Application: Data Handling Part 2: Parsing Various Data Formats
[Python] 100 knocks on data science (structured data processing) 027 Explanation
[Python] 100 knocks on data science (structured data processing) 029 Explanation
[Python] 100 knocks on data science (structured data processing) 015 Explanation
Python / Automatic low wrench unfitting of experimental data
[Python] 100 knocks on data science (structured data processing) 028 Explanation