I have date-time data which is stored in dataframe, as shown below. this data frame includes more than 3 years data<example: 2015,2016, 2017 , 2018 and 2019> as shown below
0 2015-02-06 00:00:00 10.397
1 2015-02-06 00:15:00 10.541
2 2015-02-06 00:30:00 10.166
3 2015-02-06 00:45:00 9.187
4 2015-02-06 01:00:00 9.158
....
138699 2019-01-20 22:45:00 6.077
138700 2019-01-20 23:00:00 5.933
138701 2019-01-20 23:15:00 5.962
138702 2019-01-20 23:30:00 6.048
138703 2019-01-20 23:45:00 6.077
Name: 0, dtype: datetime64[ns]
Now I want filter data between two years, say 2015 and 2016 and convert it into Json format as follows,
[
{
"data": [
[
1423180800000,
10.397
],
[
1423184400000,
9.158
],
[
1423185300000,
9.36
],
[
1423186200000,
9.216
],
[
1423187100000,
9.043
]
]
}
]
Could you please let me know how can achieve this using python pandas.
print (df.head())? there are 2 columns?