@@ -30,11 +30,18 @@ function __init__()
30
30
end
31
31
end
32
32
33
+ """
34
+ version()
35
+
36
+ Returns the version of the underlying Python Pandas library as a VersionNumber.
37
+ """
38
+ version () = VersionNumber (pandas_raw. __version__)
39
+
33
40
const pre_type_map = []
34
41
35
42
# Maps a python object corresponding to a Pandas class to a Julia type which
36
43
# wraps that class.
37
- const type_map = Dict {PyObject, Type} ()
44
+ const type_map = Dict ()
38
45
39
46
abstract type PandasWrapped end
40
47
@@ -102,6 +109,7 @@ to that class.
102
109
"""
103
110
function pandas_wrap (pyo:: PyObject )
104
111
for (pyt, pyv) in type_map
112
+ pyt === nothing && continue
105
113
if pyisinstance (pyo, pyt)
106
114
return pyv (pyo)
107
115
end
@@ -185,7 +193,6 @@ macro pyasvec(class)
185
193
end
186
194
end
187
195
end
188
-
189
196
if class in [:Iloc , :Loc , :Ix ]
190
197
length_expr = quote
191
198
function $ (esc (:length ))(x:: $class )
@@ -213,11 +220,11 @@ end
213
220
214
221
@pytype DataFrame ()-> pandas_raw. core. frame." DataFrame"
215
222
@pytype Iloc ()-> pandas_raw. core. indexing." _iLocIndexer"
216
- @pytype Loc ()-> pandas_raw. core. indexing." _LocIndexer"
217
- @pytype Ix ()-> pandas_raw. core. indexing." _IXIndexer"
218
223
@pytype Series ()-> pandas_raw. core. series." Series"
219
- @pytype MultiIndex ()-> pandas_raw. core. index." MultiIndex"
220
- @pytype Index ()-> pandas_raw. core. index." Index"
224
+ @pytype Ix ()-> version () < VersionNumber (1 ) ? pandas_raw. core. indexing." _IXIndexer" : nothing
225
+ @pytype MultiIndex ()-> version () < VersionNumber (1 ) ? pandas_raw. core. index." MultiIndex" : pandas_raw. core. indexes. multi." MultiIndex"
226
+ @pytype Index ()-> version () < VersionNumber (1 ) ? pandas_raw. core. index." Index" : pandas_raw. core. indexes. multi." Index"
227
+ @pytype Loc ()-> pandas_raw. core. indexing." _LocIndexer"
221
228
@pytype GroupBy ()-> pandas_raw. core. groupby." DataFrameGroupBy"
222
229
@pytype SeriesGroupBy ()-> pandas_raw. core. groupby." SeriesGroupBy"
223
230
@pytype Rolling () -> pandas_raw. core. window." Rolling"
0 commit comments