Skip to content

Conversation

@tsdlovell
Copy link
Contributor

BUG: fix issue with concat of localized timestamps
TST: test concat of dataframes with non-None timezone columns

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the issue number here as well

@jreback jreback added Bug Timezones Timezone data dtype labels Feb 26, 2016
@tsdlovell
Copy link
Contributor Author

Created #12467 and added it in test comment

@jreback
Copy link
Contributor

jreback commented Feb 27, 2016

xref to #12396 which is closed by #12403

@jreback jreback modified the milestones: 0.18.0, 0.18.1 Feb 27, 2016
@jreback
Copy link
Contributor

jreback commented Apr 4, 2016

ping!

@tsdlovell
Copy link
Contributor Author

Hey Jeff, I've looked into the other failures a little but don't fully understand when/why the expected dims change. It looks like merge (the tests that fail) always wants a 1d array and is failing because we are using atleast_2d on one of our inputs to make our (2-d, 1-d) input combo compatible. Perhaps we should instead be making the 2-d into a 1-d? Is this just playing wack-a-mole?

@jreback
Copy link
Contributor

jreback commented Apr 4, 2016

a bit of a hack, but assure 2d-ness only when we are axis=1 concat.

diff --git a/pandas/tseries/common.py b/pandas/tseries/common.py
index f32e9b9..11a5fdc 100644
--- a/pandas/tseries/common.py
+++ b/pandas/tseries/common.py
@@ -260,8 +260,7 @@ def _concat_compat(to_concat, axis=0, typs=None):
         # if dtype is of datetimetz or timezone
         if x.dtype.kind == _NS_DTYPE.kind:
             if getattr(x, 'tz', None) is not None:
-                x = x.asobject
-                x = np.atleast_2d(x)
+                x = x.asobject.values
             else:
                 shape = x.shape
                 x = tslib.ints_to_pydatetime(x.view(np.int64).ravel())
@@ -272,6 +271,8 @@ def _concat_compat(to_concat, axis=0, typs=None):
             x = tslib.ints_to_pytimedelta(x.view(np.int64).ravel())
             x = x.reshape(shape)

+        if axis == 1:
+            x = np.atleast_2d(x)
         return x

     if typs is None:

@tsdlovell
Copy link
Contributor Author

That passes the tests that were failing. Unfortunately, can't push from work. Will make that change this evening.

@jreback
Copy link
Contributor

jreback commented Apr 4, 2016

@tsdlovell np.

@tsdlovell
Copy link
Contributor Author

travis is failing on OSX and py3.5 at the same points

ERROR: test_range_slice_day (pandas.tseries.tests.test_period.TestPeriodIndex)

Traceback (most recent call last):
File "/Users/travis/build/pydata/pandas/pandas/tseries/tests/test_period.py", line 2619, in test_range_slice_day
idx[v:]
File "/Users/travis/build/pydata/pandas/pandas/tseries/base.py", line 176, in getitem
result = getitem(key)

IndexError: failed to coerce slice entry of type str to integer

ERROR: test_range_slice_seconds (pandas.tseries.tests.test_period.TestPeriodIndex)

Traceback (most recent call last):
File "/Users/travis/build/pydata/pandas/pandas/tseries/tests/test_period.py", line 2676, in test_range_slice_seconds
idx[v:]
File "/Users/travis/build/pydata/pandas/pandas/tseries/base.py", line 176, in getitem
result = getitem(key)
IndexError: failed to coerce slice entry of type str to integer

Was working in the env I created a bit ago, but fails in an env I just created, so maybe something to do with change in dependencies. Will look into it.

@jreback
Copy link
Contributor

jreback commented Apr 5, 2016

numpy 1.11 was just updated fully in conda
I am about to push the fixes for this

@jreback
Copy link
Contributor

jreback commented Apr 5, 2016

rebase and should be good to go

TST: test concat of dataframes with non-None timezone columns
@jreback
Copy link
Contributor

jreback commented Apr 6, 2016

@tsdlovell thank you sir!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Timezones Timezone data dtype

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants