šŸ•·ļø Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 147 (from laksa117)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ā„¹ļø Skipped - page is already crawled

šŸ“„
INDEXABLE
āœ…
CRAWLED
7 hours ago
šŸ¤–
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://sentry.io/answers/remove-dataframe-rows-with-missing-values-in-python/
Last Crawled2026-04-08 07:39:46 (7 hours ago)
First Indexed2024-02-02 05:01:22 (2 years ago)
HTTP Status Code200
Meta TitleRemove DataFrame rows with missing values in Python | Sentry
Meta DescriptionSentry helps developers monitor and fix crashes in real time. Get the details you need to resolve the most important issues quickly.
Meta Canonicalnull
Boilerpipe Text
The Problem In Pandas, how do I remove DataFrame rows that contain None or NaN across all columns? How can I do this when these values are present in only some columns? The Solution We can achieve both of these results using the DataFrame.dropna method. For example: import pandas from numpy import nan df = pandas . DataFrame ( { "Test 1" : [ 90 , 10 , nan , nan ] , "Test 2" : [ 41 , nan , 32 , nan ] , "Test 3" : [ 89 , 35 , 72 , nan ] , "Test 4" : [ 52 , nan , nan , nan ] , } ) print ( df ) # output: # Test 1 Test 2 Test 3 Test 4 # 0 90.0 41.0 89.0 52.0 # 1 10.0 NaN 35.0 NaN # 2 NaN 32.0 72.0 NaN # 3 NaN NaN NaN NaN df_no_empty_rows = df . dropna ( how = "all" ) # drop rows containing all NaNs print ( df_no_empty_rows ) # output: # Test 1 Test 2 Test 3 Test 4 # 0 90.0 41.0 89.0 52.0 # 1 10.0 NaN 35.0 NaN # 2 NaN 32.0 72.0 NaN df_no_empty_values = df . dropna ( how = "any" ) # drop rows containing any NaNs print ( df_no_empty_values ) # output: # Test 1 Test 2 Test 3 Test 4 # 0 90.0 41.0 89.0 52.0
Markdown
[Skip to main content](https://sentry.io/answers/remove-dataframe-rows-with-missing-values-in-python/#main-content) Menu Platform Products - [Error Monitoring](https://sentry.io/product/error-monitoring/) - [Logs](https://sentry.io/product/logs/) - [Session Replay](https://sentry.io/product/session-replay/) - [Tracing](https://sentry.io/product/tracing/) - [Seer NEW](https://sentry.io/product/seer/) - [Profiling](https://sentry.io/product/profiling/) - [AI Code Review NEW](https://sentry.io/product/seer/ai-code-review/) - [Size Analysis NEW](https://sentry.io/product/size-analysis) - [Cron Monitoring](https://sentry.io/product/cron-monitoring/) - [Uptime Monitoring](https://sentry.io/product/uptime-monitoring/) - [Sentry CLI NEW](https://cli.sentry.dev/) Integrations - [![](https://sentry.io/astro-assets/nav-icons/github.png)Github](https://sentry.io/integrations/github/) - [![](https://sentry.io/astro-assets/nav-icons/slack.png)Slack](https://sentry.io/integrations/slack/) - [Sentry MCP NEW](https://mcp.sentry.dev/) - [All Integrations](https://sentry.io/integrations/) SDKs - [![](https://sentry.io/astro-assets/nav-icons/javascript.png)Javascript](https://sentry.io/for/javascript/) - [![](https://sentry.io/astro-assets/nav-icons/python.png)Python](https://sentry.io/for/python/) - [![](https://sentry.io/astro-assets/nav-icons/react.png)React](https://sentry.io/for/react/) - [![](https://sentry.io/astro-assets/nav-icons/laravel.png)Laravel](https://sentry.io/for/laravel/) - [![](https://sentry.io/astro-assets/nav-icons/nextjs.png)Next.js](https://sentry.io/for/nextjs/) - [All SDKs](https://sentry.io/platforms/) Solutions ### Solutions - [Web / Full Stack Development](https://sentry.io/for/full-stack/) - [Mobile Crash Reporting](https://sentry.io/solutions/mobile-developers/) - [Game Crash Reporting](https://sentry.io/solutions/game-developers/) - [AI Observability](https://sentry.io/solutions/ai-observability/) - [Application Performance Monitoring](https://sentry.io/solutions/application-performance-monitoring/) - [Real User Monitoring](https://sentry.io/solutions/real-user-monitoring-rum/) - [Ecommerce](https://sentry.io/solutions/ecommerce/) - [Enterprise](https://sentry.io/for/enterprise/) - [Startups](https://sentry.io/for/startups/) Resources Learn - [Blog](https://blog.sentry.io/) - [Changelog](https://sentry.io/changelog/) - [Sandbox](https://sandbox.sentry.io/) - [Resources](https://sentry.io/resources/) - [Syntax](https://syntax.fm/) - [Customers](https://sentry.io/customers/) - [Cookbook](https://sentry.io/cookbook/) Support - [Contact Us](https://sentry.io/contact/enterprise/) - [Help Center](https://help.sentry.io/) - [Status](https://status.sentry.io/) Hang out with us - [Sentry Build](https://sentry.io/resources/sentry-build/) - [Events](https://sentry.io/events/) - [Merch](https://sentry.shop/) [Docs](https://docs.sentry.io/) [Pricing](https://sentry.io/pricing/) [Sign In](https://sentry.io/auth/login/) [Get Demo](https://sentry.io/demo/) [Get Started](https://sentry.io/signup/) - Platform - Solutions - [Web / Full Stack Development](https://sentry.io/for/full-stack/) - [Mobile Crash Reporting](https://sentry.io/solutions/mobile-developers/) - [Game Crash Reporting](https://sentry.io/solutions/game-developers/) - [AI Observability](https://sentry.io/solutions/ai-observability/) - [Application Performance Monitoring](https://sentry.io/solutions/application-performance-monitoring/) - [Real User Monitoring](https://sentry.io/solutions/real-user-monitoring-rum/) - [Ecommerce](https://sentry.io/solutions/ecommerce/) - [Enterprise](https://sentry.io/for/enterprise/) - [Startups](https://sentry.io/for/startups/) - Resources - [Docs](https://docs.sentry.io/) - [Pricing](https://sentry.io/pricing/) [Sign In](https://sentry.io/auth/login/) [Get Demo](https://sentry.io/demo/) [Get Started](https://sentry.io/signup/) [Sentry Answers](https://sentry.io/answers/) \> [Python](https://sentry.io/answers/python/) \> Remove DataFrame rows with missing values in Python # Remove DataFrame rows with missing values in Python ![](https://sentry.io/astro-assets/legacy/ghost.png) David Y. — October 15, 2023 [jump to solution](https://sentry.io/answers/remove-dataframe-rows-with-missing-values-in-python/#the-solution) ## The Problem In Pandas, how do I remove DataFrame rows that contain `None` or `NaN` across all columns? How can I do this when these values are present in only some columns? ## The Solution We can achieve both of these results using the [`DataFrame.dropna`](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.dropna.html) method. For example: ``` import pandas from numpy import nan df = pandas.DataFrame( { "Test 1": [90, 10, nan, nan], "Test 2": [41, nan, 32, nan], "Test 3": [89, 35, 72, nan], "Test 4": [52, nan, nan, nan], } ) print(df) # output: # Test 1 Test 2 Test 3 Test 4 # 0 90.0 41.0 89.0 52.0 # 1 10.0 NaN 35.0 NaN # 2 NaN 32.0 72.0 NaN # 3 NaN NaN NaN NaN df_no_empty_rows = df.dropna(how="all") # drop rows containing all NaNs print(df_no_empty_rows) # output: # Test 1 Test 2 Test 3 Test 4 # 0 90.0 41.0 89.0 52.0 # 1 10.0 NaN 35.0 NaN # 2 NaN 32.0 72.0 NaN df_no_empty_values = df.dropna(how="any") # drop rows containing any NaNs print(df_no_empty_values) # output: # Test 1 Test 2 Test 3 Test 4 # 0 90.0 41.0 89.0 52.0 ``` ### More Python content - Codecov [Python - Codecov (opens in a new tab)](https://about.codecov.io/language/python/) - Sentry Blog [Logging in Python: A Developer's Guide (opens in a new tab)](https://blog.sentry.io/logging-in-python-a-developers-guide/#python-logging-best-practices) - Sentry Blog [Python Performance Testing: A Comprehensive Guide (opens in a new tab)](https://blog.sentry.io/python-performance-testing-a-comprehensive-guide/) - Engineering Blog [Testing in Hundreds of Environments (opens in a new tab)](https://sentry.engineering/blog/how-we-run-our-python-tests-in-hundreds-of-environments-really-fast) - ![Syntax.fm logo](https://sentry.io/astro-assets/legacy/syntax-logo.png) [Listen to the Syntax Podcast (opens in a new tab)](https://syntax.fm/?utm_source=sentry&utm_medium=display&utm_campaign=syntax-na-podcastpromo&utm_content=logo-answers-rail-banner-listen) Tasty treats for web developers brought to you by Sentry. Get tips and tricks from Wes Bos and Scott Tolinski. [SEE EPISODES](https://syntax.fm/?utm_source=sentry&utm_medium=display&utm_campaign=syntax-na-podcastpromo&utm_content=logo-answers-rail-banner-listen) ## Related Answers [Make a list of the column headers in a Python Pandas DataFrame](https://sentry.io/answers/make-a-list-of-the-column-headers-in-a-python-pandas-dataframe/) David Y. — November 15, 2023 [Set individual font sizes for labels and titles in \`pyplot\` graphs](https://sentry.io/answers/set-individual-font-sizes-for-labels-and-titles-in-pyplot-graphs/) David Y. — November 15, 2023 [Logical AND (&&) in Python](https://sentry.io/answers/logical-and-in-python/) David Y. — May 15, 2023 [Split a string into a list of words in Python](https://sentry.io/answers/split-a-string-into-a-list-of-words-in-python/) David Y. — June 15, 2024 Considered "not bad" by 4 million developers and more than 150,000 organizations worldwide, Sentry provides code-level observability to many of the world's best-known companies like Disney, Peloton, Cloudflare, Eventbrite, Slack, Supercell, and Rockstar Games. Each month we process billions of exceptions from the most popular products on the internet. [learn more about sentry](https://sentry.io/) [join our discord](https://discord.com/invite/sentry) ![Sentry](https://sentry.io/_astro/answer-cta-light.CRAdOWkA.svg) ### Company - [About](https://sentry.io/about/) - [Blog](https://blog.sentry.io/) - [Careers](https://sentry.io/careers/) - [Contact Us](https://sentry.io/contact/enterprise/) - [Trust](https://sentry.io/trust/) ### Platform - [Error Monitoring](https://sentry.io/product/error-monitoring/) - [Tracing](https://sentry.io/product/tracing/) - [Session Replay](https://sentry.io/product/session-replay/) - [Seer](https://sentry.io/product/seer/) - [Logs](https://sentry.io/product/logs/) - [Uptime Monitoring](https://sentry.io/product/uptime-monitoring/) - [Profiling](https://sentry.io/product/profiling/) - [Cron Monitoring](https://sentry.io/product/cron-monitoring/) - [Integrations](https://sentry.io/integrations/) ### Solutions - [Web / Full Stack Development](https://sentry.io/for/full-stack/) - [Mobile Crash Reporting](https://sentry.io/solutions/mobile-developers/) - [Game Crash Reporting](https://sentry.io/solutions/game-developers/) - [AI Observability](https://sentry.io/solutions/ai-observability/) - [Application Performance Monitoring](https://sentry.io/solutions/application-performance-monitoring/) - [Real User Monitoring](https://sentry.io/solutions/real-user-monitoring-rum/) - [Ecommerce](https://sentry.io/solutions/ecommerce/) - [Enterprise](https://sentry.io/for/enterprise/) - [Startups](https://sentry.io/for/startups/) ### Get Help - [Docs](https://docs.sentry.io/) - [Help Center](https://help.sentry.io/) - [Status](https://status.sentry.io/) - [Dev Resources](https://develop.sentry.dev/getting-started/) [Terms](https://sentry.io/terms/) [Security & Compliance](https://sentry.io/security/) [Privacy](https://sentry.io/privacy/) [![](https://sentry.io/astro-assets/nav-icons/x-twitter.png) Twitter Menu Button](https://x.com/sentry/) [![](https://sentry.io/astro-assets/nav-icons/github.png) Github Social Menu Button](https://github.com/getsentry/) [![](https://sentry.io/astro-assets/nav-icons/linkedin.png) LinkedIn Menu Button](https://linkedin.com/company/getsentry/) [![](https://sentry.io/astro-assets/nav-icons/discord.png) Discord Menu Button](https://discord.gg/sentry) Ā© 2026 • Sentry is a registered Trademark of Functional Software, Inc.
Readable Markdown
## The Problem In Pandas, how do I remove DataFrame rows that contain `None` or `NaN` across all columns? How can I do this when these values are present in only some columns? ## The Solution We can achieve both of these results using the [`DataFrame.dropna`](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.dropna.html) method. For example: ``` import pandas from numpy import nan df = pandas.DataFrame( { "Test 1": [90, 10, nan, nan], "Test 2": [41, nan, 32, nan], "Test 3": [89, 35, 72, nan], "Test 4": [52, nan, nan, nan], } ) print(df) # output: # Test 1 Test 2 Test 3 Test 4 # 0 90.0 41.0 89.0 52.0 # 1 10.0 NaN 35.0 NaN # 2 NaN 32.0 72.0 NaN # 3 NaN NaN NaN NaN df_no_empty_rows = df.dropna(how="all") # drop rows containing all NaNs print(df_no_empty_rows) # output: # Test 1 Test 2 Test 3 Test 4 # 0 90.0 41.0 89.0 52.0 # 1 10.0 NaN 35.0 NaN # 2 NaN 32.0 72.0 NaN df_no_empty_values = df.dropna(how="any") # drop rows containing any NaNs print(df_no_empty_values) # output: # Test 1 Test 2 Test 3 Test 4 # 0 90.0 41.0 89.0 52.0 ```
Shard147 (laksa)
Root Hash17800916657557307547
Unparsed URLio,sentry!/answers/remove-dataframe-rows-with-missing-values-in-python/ s443