BUG #10228: segfault due to out-of-bounds in binning
Closes #10228.   I also deleted some duplicated code while I was at it.

So, I wasn't sure if I should be including a unit test for this.  This issue was a segfault, which was happening when you do:

```
s = pd.Series([], index=pd.DatetimeIndex([]), dtype=np.object)
s.resample('d', how='count')
```

so I suppose I could add this code into a test, and just verify it doesn't segfault, but that seemed like a bad idea.  It would be testing for something that's undefined behavior and therefore be a non-deterministic test.
