-4

Hi I have a list( tranforming a numpy array to list) that contains a number of values. I try to use it to replace all of the NaN values that I have in a pandas column but I get the following error:

TypeError: "value" parameter must be a scalar or dict, but you passed a "list"

The line of code I use to do the fill is

df.column.fillna(list,inplace=True)

Any help highly appreciated

Andrei Cozma
  • 950
  • 3
  • 9
  • 14
  • 5
    error is clear, did you read the [docs](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.fillna.html#pandas.Series.fillna)? – EdChum Dec 13 '16 at 14:09
  • The documentation clearly states : IT CANNOT BE A LIST – MMF Dec 13 '16 at 14:10
  • any way in which I can use a list. My fillna, was a try I had at fixing the problem I have not the only solution – Andrei Cozma Dec 13 '16 at 14:11
  • How would you use a list? Please include a [MCVE]. – IanS Dec 13 '16 at 14:15
  • It's unclear what the problem is with pass a scalar or a dict which is what is accepted by that method. Why must you use a list? – EdChum Dec 13 '16 at 14:15

1 Answers1

0

I managed to fix this, by transforming my list to a series and that creating a new column with that series. After which I replaced all NaN's with values from the new column as per Python Pandas replace NaN in one column with value from corresponding row of second column

This seems to me like a bit of a long way for what I thought might be easier in python. Thanks for stating the obvious EdChum ;)

Community
  • 1
  • 1
Andrei Cozma
  • 950
  • 3
  • 9
  • 14