I am using pd.Grouper
to group my time-series in frequency of 3 days.To retrieve the time array, I use date = df.index.values
which returns me an array of time which looks like this:
array(['2010-01-31T00:00:00.000000000', '2010-02-03T00:00:00.000000000',
'2017-05-12T00:00:00.000000000', '2017-05-15T00:00:00.000000000',
'2017-05-18T00:00:00.000000000', '2017-05-21T00:00:00.000000000',
'2017-05-24T00:00:00.000000000', '2017-05-27T00:00:00.000000000',
'2017-05-30T00:00:00.000000000', '2017-06-02T00:00:00.000000000',
'2017-06-05T00:00:00.000000000', '2017-06-08T00:00:00.000000000',
'2017-06-11T00:00:00.000000000', '2017-06-14T00:00:00.000000000',
'2017-06-17T00:00:00.000000000', '2017-06-20T00:00:00.000000000',
'2017-06-23T00:00:00.000000000', '2017-06-26T00:00:00.000000000',
'2017-06-29T00:00:00.000000000', '2017-07-02T00:00:00.000000000',
'2017-07-05T00:00:00.000000000', '2017-07-08T00:00:00.000000000',
'2017-07-11T00:00:00.000000000', '2017-07-14T00:00:00.000000000',
'2017-07-17T00:00:00.000000000', '2017-07-20T00:00:00.000000000',
'2017-07-23T00:00:00.000000000', '2017-07-26T00:00:00.000000000',
'2017-07-29T00:00:00.000000000', '2017-08-01T00:00:00.000000000',
'2017-08-04T00:00:00.000000000', '2017-08-07T00:00:00.000000000'],
dtype='datetime64[ns]')
I have been trying to get just date (and eventually MJD out of it). It works when I copy 1-2 elements of this array and do this;
times =['2010-02-03T00:00:00.000000000','2010-02-03T00:00:00.000000000']
t = Time(times, format='isot', scale='utc')
print(t.mjd)
>>[55230. 55230.]
However, I am not able to use the same type of code for the entire array
from astropy.time import Time
t = Time(date, format='isot', scale='utc')
print(t.mjd)
it gives me an error "Input values did not match the format class isot". So, I guessed that Time will require list rather than an array but changing Date to list doesn't fix the problem. I am not able to work it out, the example above is a list of 2 strings and it works fine. What am I doing wrong here? I have tried few other ways using pandas and trying to loop over elements. Thanks for the help. Abhi