@@ -279,7 +279,7 @@ def iteritems(self):
279
279
return ((k , self [k ]) for k in self .columns )
280
280
281
281
iterkv = iteritems
282
- if py3compat .PY3 :
282
+ if py3compat .PY3 : # pragma: no cover
283
283
items = iteritems
284
284
285
285
def __len__ (self ):
@@ -726,25 +726,6 @@ def _unpickle_matrix_compat(self, state): # pragma: no cover
726
726
727
727
self ._data = dm ._data
728
728
729
- #----------------------------------------------------------------------
730
- # Private helper methods
731
-
732
- def _intersect_index (self , other ):
733
- common_index = self .index
734
-
735
- if not common_index .equals (other .index ):
736
- common_index = common_index .intersection (other .index )
737
-
738
- return common_index
739
-
740
- def _intersect_columns (self , other ):
741
- common_cols = self .columns
742
-
743
- if not common_cols .equals (other .columns ):
744
- common_cols = common_cols .intersection (other .columns )
745
-
746
- return common_cols
747
-
748
729
#----------------------------------------------------------------------
749
730
# Array interface
750
731
@@ -981,13 +962,9 @@ def xs(self, key, axis=0, copy=True):
981
962
return Series (new_values , index = self .columns , name = key )
982
963
else :
983
964
new_data = self ._data .xs (key , axis = 1 , copy = copy )
984
- if new_data .ndim == 1 :
985
- return Series (new_data .as_matrix (), index = self .columns ,
986
- name = key )
987
- else :
988
- result = DataFrame (new_data )
989
- result .index = _maybe_droplevels (result .index , key )
990
- return result
965
+ result = DataFrame (new_data )
966
+ result .index = _maybe_droplevels (result .index , key )
967
+ return result
991
968
992
969
#----------------------------------------------------------------------
993
970
# Reindexing and alignment
@@ -1465,15 +1442,6 @@ def _combine_frame(self, other, func, fill_value=None):
1465
1442
this , other = self .align (other , join = 'outer' , copy = False )
1466
1443
new_index , new_columns = this .index , this .columns
1467
1444
1468
- # some shortcuts
1469
- if fill_value is None :
1470
- if not self and not other :
1471
- return self ._constructor (index = new_index )
1472
- elif not self :
1473
- return other * nan
1474
- elif not other :
1475
- return self * nan
1476
-
1477
1445
this_vals = this .values
1478
1446
other_vals = other .values
1479
1447
@@ -2174,7 +2142,7 @@ def join(self, other, on=None, how=None, lsuffix='', rsuffix=''):
2174
2142
return self ._join_index (other , how , lsuffix , rsuffix )
2175
2143
2176
2144
def _join_on (self , other , on , how , lsuffix , rsuffix ):
2177
- if how not in [ 'left' , 'inner' ]:
2145
+ if how not in ( 'left' , 'inner' ): # pragma: no cover
2178
2146
raise Exception ('Only inner / left joins currently supported' )
2179
2147
2180
2148
if isinstance (other , Series ):
@@ -3295,7 +3263,7 @@ def _homogenize(data, index, columns, dtype=None):
3295
3263
def _put_str (s , space ):
3296
3264
return ('%s' % s )[:space ].ljust (space )
3297
3265
3298
- def install_ipython_completers ():
3266
+ def install_ipython_completers (): # pragma: no cover
3299
3267
"""Register the DataFrame type with IPython's tab completion machinery, so
3300
3268
that it knows about accessing column names as attributes."""
3301
3269
from IPython .utils .generics import complete_object
@@ -3307,7 +3275,7 @@ def complete_dataframe(obj, prev_completions):
3307
3275
3308
3276
# Importing IPython brings in about 200 modules, so we want to avoid it unless
3309
3277
# we're in IPython (when those modules are loaded anyway).
3310
- if "IPython" in sys .modules :
3278
+ if "IPython" in sys .modules : # pragma: no cover
3311
3279
try :
3312
3280
install_ipython_completers ()
3313
3281
except Exception :
0 commit comments