How to filter an sframe on a specific date range?

User 3517 | 3/12/2016, 8:12:27 PM

I have some data loaded in csv formart in SFrame for an year and has a date column in it. SFrame sees it as a string, so I converted into datetime data type. Now How would I filter the data for a particular month? Datetime format is like 2016-01-01 00:00:00


User 15 | 3/13/2016, 3:10:40 AM

Hi @dsuser,

Are you using GraphLab Create, or the SFrame package?

If you are using GraphLab Create, you may want to convert your SFrame to a TimeSeries. Then you can check out slice for arbitrary date ranges or group for grouping your data by month. Then you can examine each month's data separately.

If you are using the open-source SFrame package, TimeSeries has not made it over there yet (but it will!). In the meantime, you can do this little hack: <pre> my_sframe['timeafterepoch'] = mysframe['timestamp'].astype(int) mysframe[(my_sframe['timeafterepoch'] >= startofmonth) & (my_sframe['timeafterepoch'] <= end of month)] </pre>

User 3517 | 3/14/2016, 11:02:35 PM

Thank you, that worked.