Skip to content

CLN: Initialization coincides with mapping, hence with uniqueness check #13594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions pandas/index.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ cdef class IndexEngine:

cdef:
bint unique, monotonic_inc, monotonic_dec
bint initialized, monotonic_check, unique_check
bint initialized, monotonic_check

def __init__(self, vgetter, n):
self.vgetter = vgetter
Expand All @@ -91,7 +91,6 @@ cdef class IndexEngine:
self.monotonic_check = 0

self.unique = 0
self.unique_check = 0
self.monotonic_inc = 0
self.monotonic_dec = 0

Expand Down Expand Up @@ -211,8 +210,8 @@ cdef class IndexEngine:
property is_unique:

def __get__(self):
if not self.unique_check:
self._do_unique_check()
if not self.initialized:
self.initialize()

return self.unique == 1

Expand Down Expand Up @@ -246,9 +245,6 @@ cdef class IndexEngine:
cdef _get_index_values(self):
return self.vgetter()

cdef inline _do_unique_check(self):
self._ensure_mapping_populated()

def _call_monotonic(self, values):
raise NotImplementedError

Expand All @@ -270,7 +266,6 @@ cdef class IndexEngine:

if len(self.mapping) == len(values):
self.unique = 1
self.unique_check = 1

self.initialized = 1

Expand Down