6868quot (x) = Expr (:quote , x)
6969
7070function Base. Array (x:: PandasWrapped )
71- c = np[ : asarray] (x. pyo)
71+ c = np. asarray (x. pyo)
7272 if typeof (c). parameters[1 ] == PyObject
7373 out = Array {Any} (undef, size (x))
7474 for idx in eachindex (out)
8383
8484function Base. values (x:: PandasWrapped )
8585 # Zero-copy conversion to a Julia native type is possible
86- x_kind = x. pyo[ : dtype][ : kind]
86+ x_kind = x. pyo. dtype. kind
8787 if x_kind in [" i" , " u" , " f" , " b" ]
88- pyarray = convert (PyArray, x. pyo[ " values" ] )
88+ pyarray = convert (PyArray, x. pyo. " values" )
8989 unsafe_wrap (Array, pyarray. data, size (pyarray))
9090 else # Convert element by element otherwise
9191 collect (x)
@@ -132,7 +132,7 @@ function pyattr(class, jl_method, py_method)
132132 quote
133133 function $ (esc (jl_method))(pyt:: $class , args... ; kwargs... )
134134 new_args = fix_arg .(args)
135- method = pyt. pyo[ $ (string (py_method))]
135+ method = pyt. pyo. $ (string (py_method))
136136 pyo = pycall (method, PyObject, new_args... ; kwargs... )
137137 wrapped = pandas_wrap (pyo)
138138 end
@@ -169,31 +169,31 @@ macro pyasvec(class)
169169 offset = should_offset (pyt, args... )
170170 new_args = tuple ([fix_arg (arg, offset) for arg in args]. .. )
171171 new_args = (length (new_args)== 1 ? new_args[1 ] : new_args)
172- pyo = pycall (pyt. pyo[ : __getitem__] , PyObject, new_args)
172+ pyo = pycall (pyt. pyo. __getitem__, PyObject, new_args)
173173 pandas_wrap (pyo)
174174 end
175175
176176 function $ (esc (:setindex! ))(pyt:: $class , value, idxs... )
177177 offset = should_offset (pyt, idxs... )
178178 new_idx = [fix_arg (idx, offset) for idx in idxs]
179179 if length (new_idx) > 1
180- pandas_wrap (pycall (pyt. pyo[ : __setitem__] , PyObject, tuple (new_idx... ), value))
180+ pandas_wrap (pycall (pyt. pyo. __setitem__, PyObject, tuple (new_idx... ), value))
181181 else
182- pandas_wrap (pycall (pyt. pyo[ : __setitem__] , PyObject, new_idx[1 ], value))
182+ pandas_wrap (pycall (pyt. pyo. __setitem__, PyObject, new_idx[1 ], value))
183183 end
184184 end
185185 end
186186
187187 if class in [:Iloc , :Loc , :Ix ]
188188 length_expr = quote
189189 function $ (esc (:length ))(x:: $class )
190- x. pyo[ : obj][ : __len__] ()
190+ x. pyo. obj. __len__ ()
191191 end
192192 end
193193 else
194194 length_expr = quote
195195 function $ (esc (:length ))(x:: $class )
196- x. pyo[ : __len__] ()
196+ x. pyo. __len__ ()
197197 end
198198 end
199199 end
@@ -209,16 +209,16 @@ macro pyasvec(class)
209209end
210210
211211
212- @pytype DataFrame ()-> pandas_raw[ : core][ : frame][ " DataFrame" ]
213- @pytype Iloc ()-> pandas_raw[ : core][ : indexing][ " _iLocIndexer" ]
214- @pytype Loc ()-> pandas_raw[ : core][ : indexing][ " _LocIndexer" ]
215- @pytype Ix ()-> pandas_raw[ : core][ : indexing][ " _IXIndexer" ]
216- @pytype Series ()-> pandas_raw[ : core][ : series][ " Series" ]
217- @pytype MultiIndex ()-> pandas_raw[ : core][ : index][ " MultiIndex" ]
218- @pytype Index ()-> pandas_raw[ : core][ : index][ " Index" ]
219- @pytype GroupBy ()-> pandas_raw[ : core][ : groupby][ " DataFrameGroupBy" ]
220- @pytype SeriesGroupBy ()-> pandas_raw[ : core][ : groupby][ " SeriesGroupBy" ]
221- @pytype Rolling () -> pandas_raw[ : core][ : window][ " Rolling" ]
212+ @pytype DataFrame ()-> pandas_raw. core. frame. " DataFrame"
213+ @pytype Iloc ()-> pandas_raw. core. indexing. " _iLocIndexer"
214+ @pytype Loc ()-> pandas_raw. core. indexing. " _LocIndexer"
215+ @pytype Ix ()-> pandas_raw. core. indexing. " _IXIndexer"
216+ @pytype Series ()-> pandas_raw. core. series. " Series"
217+ @pytype MultiIndex ()-> pandas_raw. core. index. " MultiIndex"
218+ @pytype Index ()-> pandas_raw. core. index. " Index"
219+ @pytype GroupBy ()-> pandas_raw. core. groupby. " DataFrameGroupBy"
220+ @pytype SeriesGroupBy ()-> pandas_raw. core. groupby. " SeriesGroupBy"
221+ @pytype Rolling () -> pandas_raw. core. window. " Rolling"
222222
223223@pyattr GroupBy app apply
224224@pyattr Rolling app apply
@@ -246,12 +246,12 @@ pyattr_set([DataFrame, Series], :T, :abs, :align, :any, :argsort, :asfreq, :asof
246246pyattr_set ([DataFrame], :groupby )
247247pyattr_set ([Series, DataFrame], :rolling )
248248
249- Base. size (x:: Union{Loc, Iloc, Ix} ) = x. pyo[ : obj][ : shape]
249+ Base. size (x:: Union{Loc, Iloc, Ix} ) = x. pyo. obj. shape
250250Base. size (df:: PandasWrapped , i:: Integer ) = size (df)[i]
251- Base. size (df:: PandasWrapped ) = df. pyo[ : shape]
251+ Base. size (df:: PandasWrapped ) = df. pyo. shape
252252
253- Base. isempty (df:: PandasWrapped ) = df. pyo[ : empty]
254- Base. empty! (df:: PandasWrapped ) = df. pyo[ : drop] (df. pyo[ : index] , inplace= true )
253+ Base. isempty (df:: PandasWrapped ) = df. pyo. empty
254+ Base. empty! (df:: PandasWrapped ) = df. pyo. drop (df. pyo. index, inplace= true )
255255
256256should_offset (:: Any , args... ) = false
257257should_offset (:: Union{Iloc, Index} , args... ) = true
267267
268268for attr in [:index , :columns ]
269269 @eval function $attr (x:: PandasWrapped )
270- pandas_wrap (x. pyo[ $ (string (attr))] )
270+ pandas_wrap (x. pyo. $ (string (attr)))
271271 end
272272end
273273
@@ -304,7 +304,7 @@ for m in [:read_pickle, :read_csv, :read_html, :read_json, :read_excel, :read_ta
304304end
305305
306306function show (io:: IO , df:: PandasWrapped )
307- s = df. pyo[ : __str__] ()
307+ s = df. pyo. __str__ ()
308308 println (io, s)
309309end
310310
328328
329329for m in [:from_arrays , :from_tuples ]
330330 @eval function $m (args... ; kwargs... )
331- f = pandas_raw[ " MultiIndex" ] [string ($ (quot (m)))]
331+ f = pandas_raw. " MultiIndex" [string ($ (quot (m)))]
332332 res = pycall (f, PyObject, args... ; kwargs... )
333333 pandas_wrap (res)
334334 end
@@ -342,7 +342,7 @@ for (jl_op, py_op, py_opᵒ) in [(:+, :__add__, :__add__), (:*, :__mul__, :__mul
342342 (:& , :__and__ , :__and__ ), (:| , :__or__ , :__or__ )]
343343 @eval begin
344344 function $ (jl_op)(x:: PandasWrapped , y)
345- res = x. pyo[ $ (string (py_op))] (y)
345+ res = x. pyo. $ (string (py_op))(y)
346346 pandas_wrap (res)
347347 end
348348
@@ -351,28 +351,28 @@ for (jl_op, py_op, py_opᵒ) in [(:+, :__add__, :__add__), (:*, :__mul__, :__mul
351351 end
352352
353353 function $ (jl_op)(y, x:: PandasWrapped )
354- res = x. pyo[ $ (string (py_opᵒ))] (y)
354+ res = x. pyo. $ (string (py_opᵒ))(y)
355355 pandas_wrap (res)
356356 end
357357 end
358358end
359359
360360for op in [(:- , :__neg__ )]
361361 @eval begin
362- $ (op[1 ])(x:: PandasWrapped ) = pandas_wrap (x. pyo[ $ (quot (op[2 ]))] ())
362+ $ (op[1 ])(x:: PandasWrapped ) = pandas_wrap (x. pyo. $ (quot (op[2 ]))())
363363 end
364364end
365365
366366function setcolumns! (df:: PandasWrapped , new_columns)
367- df. pyo[ : __setattr__] (" columns" , new_columns)
367+ df. pyo. __setattr__ (" columns" , new_columns)
368368end
369369
370370function deletecolumn! (df:: DataFrame , column)
371- df. pyo[ : __delitem__] (column)
371+ df. pyo. __delitem__ (column)
372372end
373373
374- name (s:: Series ) = s. pyo[ : name]
375- name! (s:: Series , name) = s. pyo[ : name] = name
374+ name (s:: Series ) = s. pyo. name
375+ name! (s:: Series , name) = s. pyo. name = name
376376
377377include (" operators_v6.jl" )
378378
@@ -381,17 +381,17 @@ function DataFrame(pairs::Pair...)
381381end
382382
383383function index! (df:: PandasWrapped , new_index)
384- df. pyo[ : index] = new_index
384+ df. pyo. index = new_index
385385 df
386386end
387387
388388function Base. eltype (s:: Series )
389389 dtype_map = Dict (
390- np[ : dtype] (" int64" ) => Int64,
391- np[ : dtype] (" float64" ) => Float64,
392- np[ : dtype] (" object" ) => String,
390+ np. dtype (" int64" ) => Int64,
391+ np. dtype (" float64" ) => Float64,
392+ np. dtype (" object" ) => String,
393393 )
394- get (dtype_map, s. pyo[ : dtype] , Any)
394+ get (dtype_map, s. pyo. dtype, Any)
395395end
396396
397397function Base. eltype (df:: DataFrame )
@@ -411,23 +411,23 @@ function Base.map(f::Function, s::Series)
411411end
412412
413413function Base. map (x, s:: Series ; na_action= nothing )
414- pandas_wrap (s. pyo[ : map] (x, na_action))
414+ pandas_wrap (s. pyo. map (x, na_action))
415415end
416416
417417function Base. get (df:: PandasWrapped , key, default)
418- pandas_wrap (df. pyo[ : get] (key, default= default))
418+ pandas_wrap (df. pyo. get (key, default= default))
419419end
420420
421421function Base. getindex (s:: Series , c:: CartesianIndex{1} )
422422 s[c[1 ]]
423423end
424424
425425function Base. copy (df:: PandasWrapped )
426- pandas_wrap (df. pyo[ : copy] ())
426+ pandas_wrap (df. pyo. copy ())
427427end
428428
429429function ! (df:: PandasWrapped )
430- pandas_wrap (df. pyo[ : __neg__] ())
430+ pandas_wrap (df. pyo. __neg__ ())
431431end
432432
433433include (" tabletraits.jl" )
@@ -442,7 +442,7 @@ function DataFrame(obj)
442442end
443443
444444function has_named_attr (x:: Index , s)
445- return x. pyo[ : __contains__] (Symbol (s))
445+ return x. pyo. __contains__ (Symbol (s))
446446end
447447
448448named_index (x:: DataFrame ) = columns (x)
0 commit comments