Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
allowing datetime and timedelta datatype in pd cut bins #14798
Conversation
|
The change is currently WIP, will add tests and other change, @jorisvandenbossche |
sinhrks
added Algos Timedelta Timeseries
labels
Dec 4, 2016
codecov-io
commented
Dec 5, 2016
•
Current coverage is 84.64% (diff: 88.88%)@@ master #14798 diff @@
==========================================
Files 144 144
Lines 51021 51030 +9
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43188 43196 +8
- Misses 7833 7834 +1
Partials 0 0
|
| @@ -313,6 +313,18 @@ def test_datetime_cut(self): | ||
| result, bins = cut(data, 3, retbins=True) | ||
| tm.assert_series_equal(Series(result), expected) | ||
| + def test_datetime_bin(self): | ||
| + data = [np.datetime64('2012-12-13'), np.datetime64('2012-12-15')] |
aileronajay
Dec 22, 2016
•
Contributor
@jreback i dont think there is an open issue for this change, @jorisvandenbossche had proposed this change when i was making changes to cut to allow datetime and timedelta data types
| @@ -313,6 +313,18 @@ def test_datetime_cut(self): | ||
| result, bins = cut(data, 3, retbins=True) | ||
| tm.assert_series_equal(Series(result), expected) | ||
| + def test_datetime_bin(self): | ||
| + data = [np.datetime64('2012-12-13'), np.datetime64('2012-12-15')] | ||
| + bins = [np.datetime64('2012-12-12'), np.datetime64('2012-12-14'), |
jreback
Dec 5, 2016
•
Contributor
actually you prob want to test with datetime.datetime, Timestamp, np.datetime64 (but just put them in a loop something like
data = ['2012-12-12', '2012-12-14']
for conv in [Timestamp(x).to_pydatetime, Timestamp, np.datetime64]:
bins = [ conv(v) for v in data ]
also test
bins = pd.to_datetime(data)
these should all work, because internally you need to wrap a Timestamp converter around each of fhe bins (if dtype==M8) or Timedelta if dtype==m8
aileronajay
Dec 22, 2016
Contributor
@jreback made the changes, i added a new method in tile.py to handle the time type bins
jorisvandenbossche
added this to the
0.20.0
milestone
Dec 6, 2016
|
@aileronajay can you update this? |
|
@jorisvandenbossche i am caught up with some stuff right now, i should be able to make these changes next week |
aileronajay
added some commits
Dec 4, 2016
jreback
closed this
in 3e4f839
Dec 22, 2016
|
thanks! |
ShaharBental
added a commit
to ShaharBental/pandas
that referenced
this pull request
Dec 26, 2016
|
|
aileronajay + ShaharBental |
4c75674
|
aileronajay commentedDec 4, 2016
•
edited by jreback
xref #14714, follow-on to #14737