9
9
from pandas ._libs import lib
10
10
from pandas .core .dtypes .cast import maybe_upcast_putmask
11
11
from pandas import compat
12
- from pandas .compat import lzip
12
+ from pandas .compat import lzip , cPickle as pkl
13
13
import pandas .core .common as com
14
14
from pandas .core .dtypes .common import (
15
15
is_bool_dtype ,
@@ -2924,19 +2924,30 @@ def take(self, indices, axis=0, convert=None, is_copy=True, **kwargs):
2924
2924
"github.com/ray-project/ray." )
2925
2925
2926
2926
def to_clipboard (self , excel = None , sep = None , ** kwargs ):
2927
- raise NotImplementedError (
2928
- "To contribute to Pandas on Ray, please visit "
2929
- "github.com/ray-project/ray." )
2930
2927
2931
- def to_csv (self , path_or_buf = None , sep = ', ' , na_rep = '' , float_format = None ,
2928
+ warnings .warn ("Defaulting to Pandas implementation" ,
2929
+ PendingDeprecationWarning )
2930
+
2931
+ port_frame = to_pandas (self )
2932
+ port_frame .to_clipboard (excel , sep , ** kwargs )
2933
+
2934
+ def to_csv (self , path_or_buf = None , sep = ',' , na_rep = '' , float_format = None ,
2932
2935
columns = None , header = True , index = True , index_label = None ,
2933
2936
mode = 'w' , encoding = None , compression = None , quoting = None ,
2934
2937
quotechar = '"' , line_terminator = '\n ' , chunksize = None ,
2935
2938
tupleize_cols = None , date_format = None , doublequote = True ,
2936
2939
escapechar = None , decimal = '.' ):
2937
- raise NotImplementedError (
2938
- "To contribute to Pandas on Ray, please visit "
2939
- "github.com/ray-project/ray." )
2940
+
2941
+ warnings .warn ("Defaulting to Pandas implementation" ,
2942
+ PendingDeprecationWarning )
2943
+
2944
+ port_frame = to_pandas (self )
2945
+ port_frame .to_csv (path_or_buf , sep , na_rep , float_format ,
2946
+ columns , header , index , index_label ,
2947
+ mode , encoding , compression , quoting ,
2948
+ quotechar , line_terminator , chunksize ,
2949
+ tupleize_cols , date_format , doublequote ,
2950
+ escapechar , decimal )
2940
2951
2941
2952
def to_dense (self ):
2942
2953
raise NotImplementedError (
@@ -2953,14 +2964,24 @@ def to_excel(self, excel_writer, sheet_name='Sheet1', na_rep='',
2953
2964
index_label = None , startrow = 0 , startcol = 0 , engine = None ,
2954
2965
merge_cells = True , encoding = None , inf_rep = 'inf' , verbose = True ,
2955
2966
freeze_panes = None ):
2956
- raise NotImplementedError (
2957
- "To contribute to Pandas on Ray, please visit "
2958
- "github.com/ray-project/ray." )
2967
+
2968
+ warnings .warn ("Defaulting to Pandas implementation" ,
2969
+ PendingDeprecationWarning )
2970
+
2971
+ port_frame = to_pandas (self )
2972
+ port_frame .to_excel (excel_writer , sheet_name , na_rep ,
2973
+ float_format , columns , header , index ,
2974
+ index_label , startrow , startcol , engine ,
2975
+ merge_cells , encoding , inf_rep , verbose ,
2976
+ freeze_panes )
2959
2977
2960
2978
def to_feather (self , fname ):
2961
- raise NotImplementedError (
2962
- "To contribute to Pandas on Ray, please visit "
2963
- "github.com/ray-project/ray." )
2979
+
2980
+ warnings .warn ("Defaulting to Pandas implementation" ,
2981
+ PendingDeprecationWarning )
2982
+
2983
+ port_frame = to_pandas (self )
2984
+ port_frame .to_feather (fname )
2964
2985
2965
2986
def to_gbq (self , destination_table , project_id , chunksize = 10000 ,
2966
2987
verbose = True , reauth = False , if_exists = 'fail' ,
@@ -2970,26 +2991,42 @@ def to_gbq(self, destination_table, project_id, chunksize=10000,
2970
2991
"github.com/ray-project/ray." )
2971
2992
2972
2993
def to_hdf (self , path_or_buf , key , ** kwargs ):
2973
- raise NotImplementedError (
2974
- "To contribute to Pandas on Ray, please visit "
2975
- "github.com/ray-project/ray." )
2994
+
2995
+ warnings .warn ("Defaulting to Pandas implementation" ,
2996
+ PendingDeprecationWarning )
2997
+
2998
+ port_frame = to_pandas (self )
2999
+ port_frame .to_hdf (path_or_buf , key , ** kwargs )
2976
3000
2977
3001
def to_html (self , buf = None , columns = None , col_space = None , header = True ,
2978
3002
index = True , na_rep = 'np.NaN' , formatters = None ,
2979
3003
float_format = None , sparsify = None , index_names = True ,
2980
3004
justify = None , bold_rows = True , classes = None , escape = True ,
2981
3005
max_rows = None , max_cols = None , show_dimensions = False ,
2982
3006
notebook = False , decimal = '.' , border = None ):
2983
- raise NotImplementedError (
2984
- "To contribute to Pandas on Ray, please visit "
2985
- "github.com/ray-project/ray." )
3007
+
3008
+ warnings .warn ("Defaulting to Pandas implementation" ,
3009
+ PendingDeprecationWarning )
3010
+
3011
+ port_frame = to_pandas (self )
3012
+ port_frame .to_html (buf , columns , col_space , header ,
3013
+ index , na_rep , formatters ,
3014
+ float_format , sparsify , index_names ,
3015
+ justify , bold_rows , classes , escape ,
3016
+ max_rows , max_cols , show_dimensions ,
3017
+ notebook , decimal , border )
2986
3018
2987
3019
def to_json (self , path_or_buf = None , orient = None , date_format = None ,
2988
3020
double_precision = 10 , force_ascii = True , date_unit = 'ms' ,
2989
3021
default_handler = None , lines = False , compression = None ):
2990
- raise NotImplementedError (
2991
- "To contribute to Pandas on Ray, please visit "
2992
- "github.com/ray-project/ray." )
3022
+
3023
+ warnings .warn ("Defaulting to Pandas implementation" ,
3024
+ PendingDeprecationWarning )
3025
+
3026
+ port_frame = to_pandas (self )
3027
+ port_frame .to_json (path_or_buf , orient , date_format ,
3028
+ double_precision , force_ascii , date_unit ,
3029
+ default_handler , lines , compression )
2993
3030
2994
3031
def to_latex (self , buf = None , columns = None , col_space = None , header = True ,
2995
3032
index = True , na_rep = 'np.NaN' , formatters = None ,
@@ -3002,9 +3039,12 @@ def to_latex(self, buf=None, columns=None, col_space=None, header=True,
3002
3039
"github.com/ray-project/ray." )
3003
3040
3004
3041
def to_msgpack (self , path_or_buf = None , encoding = 'utf-8' , ** kwargs ):
3005
- raise NotImplementedError (
3006
- "To contribute to Pandas on Ray, please visit "
3007
- "github.com/ray-project/ray." )
3042
+
3043
+ warnings .warn ("Defaulting to Pandas implementation" ,
3044
+ PendingDeprecationWarning )
3045
+
3046
+ port_frame = to_pandas (self )
3047
+ port_frame .to_msgpack (path_or_buf , encoding , ** kwargs )
3008
3048
3009
3049
def to_panel (self ):
3010
3050
raise NotImplementedError (
@@ -3013,19 +3053,26 @@ def to_panel(self):
3013
3053
3014
3054
def to_parquet (self , fname , engine = 'auto' , compression = 'snappy' ,
3015
3055
** kwargs ):
3016
- raise NotImplementedError (
3017
- "To contribute to Pandas on Ray, please visit "
3018
- "github.com/ray-project/ray." )
3056
+
3057
+ warnings .warn ("Defaulting to Pandas implementation" ,
3058
+ PendingDeprecationWarning )
3059
+
3060
+ port_frame = to_pandas (self )
3061
+ port_frame .to_parquet (fname , engine , compression , ** kwargs )
3019
3062
3020
3063
def to_period (self , freq = None , axis = 0 , copy = True ):
3021
3064
raise NotImplementedError (
3022
3065
"To contribute to Pandas on Ray, please visit "
3023
3066
"github.com/ray-project/ray." )
3024
3067
3025
- def to_pickle (self , path , compression = 'infer' , protocol = 4 ):
3026
- raise NotImplementedError (
3027
- "To contribute to Pandas on Ray, please visit "
3028
- "github.com/ray-project/ray." )
3068
+ def to_pickle (self , path , compression = 'infer' ,
3069
+ protocol = pkl .HIGHEST_PROTOCOL ):
3070
+
3071
+ warnings .warn ("Defaulting to Pandas implementation" ,
3072
+ PendingDeprecationWarning )
3073
+
3074
+ port_frame = to_pandas (self )
3075
+ port_frame .to_pickle (path , compression , protocol )
3029
3076
3030
3077
def to_records (self , index = True , convert_datetime64 = True ):
3031
3078
raise NotImplementedError (
@@ -3039,16 +3086,25 @@ def to_sparse(self, fill_value=None, kind='block'):
3039
3086
3040
3087
def to_sql (self , name , con , flavor = None , schema = None , if_exists = 'fail' ,
3041
3088
index = True , index_label = None , chunksize = None , dtype = None ):
3042
- raise NotImplementedError (
3043
- "To contribute to Pandas on Ray, please visit "
3044
- "github.com/ray-project/ray." )
3089
+
3090
+ warnings .warn ("Defaulting to Pandas implementation" ,
3091
+ PendingDeprecationWarning )
3092
+
3093
+ port_frame = to_pandas (self )
3094
+ port_frame .to_sql (name , con , flavor , schema , if_exists ,
3095
+ index , index_label , chunksize , dtype )
3045
3096
3046
3097
def to_stata (self , fname , convert_dates = None , write_index = True ,
3047
3098
encoding = 'latin-1' , byteorder = None , time_stamp = None ,
3048
3099
data_label = None , variable_labels = None ):
3049
- raise NotImplementedError (
3050
- "To contribute to Pandas on Ray, please visit "
3051
- "github.com/ray-project/ray." )
3100
+
3101
+ warnings .warn ("Defaulting to Pandas implementation" ,
3102
+ PendingDeprecationWarning )
3103
+
3104
+ port_frame = to_pandas (self )
3105
+ port_frame .to_stata (fname , convert_dates , write_index ,
3106
+ encoding , byteorder , time_stamp ,
3107
+ data_label , variable_labels )
3052
3108
3053
3109
def to_string (self , buf = None , columns = None , col_space = None , header = True ,
3054
3110
index = True , na_rep = 'np.NaN' , formatters = None ,
0 commit comments