<p>I am trying to test a preexisting python machine learning script with a subset of my genetic data.  One of the feature columns I am using happens to only have NA values in it.  I lose this column when I use the following code:
<code>Imputer(missing_values='NaN', strategy='mean', axis=0).fit_transform(data)</code> 
This causes problems later on because my model expects the correct number of features, and I do not want to retrain my model at this time.  Is there any way to work with Imputer or fit_transform to prevent this column from getting dropped?</p>

CC BY-SA 3.0
2017-10-31T06:02:31.933Z
Join the "NA" containing column after the transformation.
arup
CC BY-SA 3.0
2017-10-31T13:48:27.283Z
I am in no way expert in machine-learning but this seems more like a programming question than a bioinformatician problem, (although you use genetic data). Consider "telling" the model that there is now one feature less. But if you have new data enough different from the original you need to retrain your model AFAIK...
llrs
CC BY-SA 3.0
2017-10-31T16:33:27.417Z
We might conceivably be able to help if you gave us some details but without your code or a dataset to test it on, we can't. You are using various commands there which, presumably, are defined in your model. We can't help if you don't tell us how they work or what they are.
terdon
<python><machine-learning>
How to prevent sklearn Imputer(missing_values="NaN", strategy="mean", axis=0).fit_transform(data) from removing columns with only NA in them
# How to prevent sklearn Imputer(missing_values="NaN", strategy="mean", axis=0).fit_transform(data) from removing columns with only NA in them

(Asked by: username_0 on 2017-10-30)

I am trying to test a preexisting python machine learning script with a subset of my genetic data. One of the feature columns I am using happens to only have NA values in it. I lose this column when I use the following code:
`Imputer(missing_values='NaN', strategy='mean', axis=0).fit_transform(data)`
This causes problems later on because my model expects the correct number of features, and I do not want to retrain my model at this time. Is there any way to work with Imputer or fit\_transform to prevent this column from getting dropped?

**Tags:** python, machine-learning
> **Comments:**
> **username_1**: Join the "NA" containing column after the transformation.  
> **username_2**: I am in no way expert in machine-learning but this seems more like a programming question than a bioinformatician problem, (although you use genetic data). Consider "telling" the model that there is now one feature less. But if you have new data enough different from the original you need to retrain your model AFAIK...  
> **username_3**: We might conceivably be able to help if you gave us some details but without your code or a dataset to test it on, we can't. You are using various commands there which, presumably, are defined in your model. We can't help if you don't tell us how they work or what they are.  

---

## 0 answers

