Skip to content
Merged
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: 10 additions & 1 deletion lib/iris/pandas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2013 - 2015, Met Office
# (C) British Crown Copyright 2013 - 2016, Met Office
#
# This file is part of Iris.
#
Expand Down Expand Up @@ -129,6 +129,15 @@ def _assert_shared(np_obj, pandas_obj):
base = pandas_obj.base
else:
base = pandas_obj[0].base

# Prior to Pandas 0.17, when pandas_obj is a Series, pandas_obj.values
# returns a view of the underlying array, and pandas_obj.base, which calls
# pandas_obj.values.base, returns the underlying array. In 0.17 and 0.18
# pandas_obj.values returns the underlying array, so base may be None even
# if the array is shared.
if base is None:
base = pandas_obj.values

# Chase the stack of NumPy `base` references back to see if any of
# them are our original array.
while base is not None:
Expand Down