Regression in ma.median handling of nan values, and calculates incorrect value
See original GitHub issueThe handling of nan
values in masked arrays passed in to ma.median
changed some time between 1.10.2 and 1.11.2, and the value returned in 1.11.2 is incorrect. In 1.10.2 nan
was returned in this case. In 1.11.2 an (incorrect) numerical result is returned.
This example demonstrates both problems:
import numpy as np
dm = np.ma.array([1, np.nan, 3])
np.ma.median(dm)
In numpy 1.10.2 the output is as expected: nan
In numpy 1.11.2 the output is incorrect (not nan
and not the correct numerical value ignoring the nan
):
masked_array(data = 3.0,
mask = False,
fill_value = 1e+20)
Based on test failures we are seeing in https://github.com/astropy/astropy/pull/5232, the issue continues in 1.12.0b1.
Issue Analytics
- State:
- Created 7 years ago
- Comments:40 (40 by maintainers)
Top Results From Across the Web
What's the best way to handle NaN values?
KNN and MICE imputations use the whole dataset to replace the NaN value, while median and mean uses only the column of the...
Read more >How to Handle Missing Data with Python
The simplest strategy for handling missing data is to remove records that contain a missing value. The simplest approach for dealing with ...
Read more >Handling missing values with R - Julie Josse
To do so we will perform regression to explain maxO3 in function of all the other variables. This data is incomplete (there are...
Read more >Chapter 8. Regression Basics - BC Open Textbooks
Regression analysis, like most multivariate statistics, allows you to infer ... Understanding that there is a distribution of y (apartment price) values at ......
Read more >Dealing with Missing Values for Data Science Beginners
Handling missing data is not a simple job in the field of data analysis. Approaches may lead to the Good, the Bad, and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m going to do a 11.3 for the file append issue, so If you fix it up for 1.12 I might put it in 1.11.3 also.
I think it would be good to squeeze it into 1.12, I’ll have a look today.