New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use pd.Int64Index()
#158
use pd.Int64Index()
#158
Conversation
* return pd.DataFrame with pd.Int64Index() index in `remove_rows()` * add `assert_empty_int64index() to use with `test_tgrtransition_with_accounting()`
New error that I hadn't seen previously related to a |
So this new error is weird, right? Seems like it's internal to numpy's round function? Is it easy to recreate? |
Per the prior issue: do we want to assume that the index will always be an int64? Could we instead just do: remove_rows.index = pd.Index(remove_rows.index.values, data.dtype) Also, do you know what pandas method is causing the index type to change? If the change happens in the sample_rows method (that method has a call to pd.concat that seems like it could be the culprit) then perhaps the change should be pushed there? |
@fscottfoti Recreated using @bridwell The only thing I might guess could be causing the index type to change is this. This and #159 are kind of hacky. It sounds like you want uniformity and consistency in the indices across objects, which I 100% agree with. The changes I made were meant to touch as little code as possible, but there may be inconsistencies with some Also, issues like these arise because of |
You can specify the library versions (which you would do here), but I generally like to notified of these kind of changes ASAP instead of finding out about them from users later. These issues are minor, but if things get harrier you may need to set up Travis to test against multiple versions of Pandas. |
Good point, @jiffyclub! Thanks for the input. I would defer to the maintainers (i.e., the individuals that are part of UDST) on how best to proceed. We could, for example, revert the changes I submitted and do something like what @bridwell suggested. Just let me know how I can help. |
Right, it seems like it might break code that has a non-integer index, unfortunately. My opinion is that a difference in a 32 bit integer index and 64 bit integer index is immaterial from UrbanSim's perspective. I blame the tests and might just force the type to 32 bit there if that's easy. |
I agree that hard-coding the index type in the code is not ideal. Why didn't using |
@jiffyclub that absolutely did work and I listed it as an alternative to what I submitted. Shall I revert and make that change? (This won't cover the |
pd.DataFrame
withpd.Int64Index()
index inremove_rows()
assert_empty_int64index()
to use withtest_tgrtransition_with_accounting()
I tried changing as little code as possible.
Note that the failed build is due to changes in pandas (possibly 0.18 (or >=0.17.1)), as commented here.
Alternatively, for the
test_*remove*all()
tests at least, thecheck_index_type
option inpdt.assert_frame_equal()
can be set toFalse
. This isn't guaranteed to fix everything.