Skip to content

Commit 67e0dbb

Browse files
authored
Merge pull request #65 from tk3369/master
Removed Ix indexer and updated Index/MultiIndex path
2 parents 2567e25 + 38cd3c9 commit 67e0dbb

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/Pandas.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@ function __init__()
3030
end
3131
end
3232

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+
3340
const pre_type_map = []
3441

3542
# Maps a python object corresponding to a Pandas class to a Julia type which
3643
# wraps that class.
37-
const type_map = Dict{PyObject, Type}()
44+
const type_map = Dict()
3845

3946
abstract type PandasWrapped end
4047

@@ -102,6 +109,7 @@ to that class.
102109
"""
103110
function pandas_wrap(pyo::PyObject)
104111
for (pyt, pyv) in type_map
112+
pyt === nothing && continue
105113
if pyisinstance(pyo, pyt)
106114
return pyv(pyo)
107115
end
@@ -185,7 +193,6 @@ macro pyasvec(class)
185193
end
186194
end
187195
end
188-
189196
if class in [:Iloc, :Loc, :Ix]
190197
length_expr = quote
191198
function $(esc(:length))(x::$class)
@@ -213,11 +220,11 @@ end
213220

214221
@pytype DataFrame ()->pandas_raw.core.frame."DataFrame"
215222
@pytype Iloc ()->pandas_raw.core.indexing."_iLocIndexer"
216-
@pytype Loc ()->pandas_raw.core.indexing."_LocIndexer"
217-
@pytype Ix ()->pandas_raw.core.indexing."_IXIndexer"
218223
@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"
221228
@pytype GroupBy ()->pandas_raw.core.groupby."DataFrameGroupBy"
222229
@pytype SeriesGroupBy ()->pandas_raw.core.groupby."SeriesGroupBy"
223230
@pytype Rolling () -> pandas_raw.core.window."Rolling"

src/exports.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ GroupBy,
4848
Rolling,
4949
Iloc,
5050
Index,
51-
Ix,
5251
Loc,
5352
MultiIndex,
5453
Series,

0 commit comments

Comments
 (0)