1
- import copy
1
+ import copy
2
2
import itertools
3
3
import re
4
4
import operator
@@ -745,10 +745,18 @@ def putmask(self, mask, new, align=True, inplace=False,
745
745
746
746
return [make_block (new_values , placement = self .mgr_locs , fastpath = True )]
747
747
748
- def interpolate (self , method = 'pad' , axis = 0 , index = None ,
748
+ def interpolate_na (self , inplace = False , ** kwargs ):
749
+ return self .interpolate (new_idxs = None , inplace = inplace , ** kwargs )
750
+
751
+ def interpolate_at (self , new_idxs , ** kwargs ):
752
+ #TODO: check dupes, nans, unique idx
753
+ return self .interpolate (new_idxs = new_idxs ,inplace = False ,** kwargs )
754
+
755
+ def interpolate (self , new_idxs = None , method = 'pad' , axis = 0 , index = None ,
749
756
values = None , inplace = False , limit = None ,
750
757
fill_value = None , coerce = False , downcast = None , ** kwargs ):
751
-
758
+ if inplace and new_idxs :
759
+ raise ValueError ('inplace=True and new_idxs not empty are incompatible options' )
752
760
def check_int_bool (self , inplace ):
753
761
# Only FloatBlocks will contain NaNs.
754
762
# timedelta subclasses IntBlock
@@ -785,7 +793,8 @@ def check_int_bool(self, inplace):
785
793
r = check_int_bool (self , inplace )
786
794
if r is not None :
787
795
return r
788
- return self ._interpolate (method = m ,
796
+ return self ._interpolate (new_idxs = new_idxs ,
797
+ method = m ,
789
798
index = index ,
790
799
values = values ,
791
800
axis = axis ,
@@ -827,7 +836,7 @@ def _interpolate_with_fill(self, method='pad', axis=0, inplace=False,
827
836
fastpath = True , placement = self .mgr_locs )]
828
837
return self ._maybe_downcast (blocks , downcast )
829
838
830
- def _interpolate (self , method = None , index = None , values = None ,
839
+ def _interpolate (self , new_idxs = None , method = None , index = None , values = None ,
831
840
fill_value = None , axis = 0 , limit = None ,
832
841
inplace = False , downcast = None , ** kwargs ):
833
842
""" interpolate using scipy wrappers """
@@ -854,7 +863,7 @@ def func(x):
854
863
# process a 1-d slice, returning it
855
864
# should the axis argument be handled below in apply_along_axis?
856
865
# i.e. not an arg to com.interpolate_1d
857
- return com .interpolate_1d (index , x , method = method , limit = limit ,
866
+ return com .interpolate_1d (index , x , new_idxs = new_idxs , method = method , limit = limit ,
858
867
fill_value = fill_value ,
859
868
bounds_error = False , ** kwargs )
860
869
0 commit comments