1

I used mpfit.py to get the some seasonal variation of data. But I can't get the seasonal variation, because my observed data had some nan values. So I can't calculate them.

Do you know the skill to avoid or ignore nan values as NAN keyword of mpfitfun.pro of IDL?

When I used the IDL, I can ignore the nan values using NAN keyword. Below is a example of IDL code.

result = MPFITFUN('MYGAUSS', t, d2009, 21.3756, start, /nan)

How can I ignore the nan values in python mpfit code?

If you know the method, Please tell me.

tomvodi
  • 5,577
  • 2
  • 27
  • 38
Lee
  • 49
  • 1
  • 4

1 Answers1

0

I am not familiar with mpfit, but if the NaNs are the problem then you could try to drop them using pandas then use mpfit with the rest of the data. Does it sound doable for you?

alec_djinn
  • 10,104
  • 8
  • 46
  • 71
  • I understood your answer that push the NaNs values to end of array. If I right understood, I don't have to push them. Because my data is function of time series. Thank you for your answer alec_djinn :) – Lee Apr 02 '15 at 13:57
  • Pandas will do all for you, it can handle [time series](http://pandas.pydata.org/pandas-docs/dev/timeseries.html) easily and drop the NaNs. – alec_djinn Apr 07 '15 at 09:42