def copy(self, deep=True):
    '\n        Make a copy of this object\'s indices and data.\n\n        When ``deep=True`` (default), a new object will be created with a\n        copy of the calling object\'s data and indices. Modifications to\n        the data or indices of the copy will not be reflected in the\n        original object (see notes below).\n\n        When ``deep=False``, a new object will be created without copying\n        the calling object\'s data or index (only references to the data\n        and index are copied). Any changes to the data of the original\n        will be reflected in the shallow copy (and vice versa).\n\n        Parameters\n        ----------\n        deep : bool, default True\n            Make a deep copy, including a copy of the data and the indices.\n            With ``deep=False`` neither the indices nor the data are copied.\n\n        Returns\n        -------\n        copy : Series, DataFrame or Panel\n            Object type matches caller.\n\n        Notes\n        -----\n        When ``deep=True``, data is copied but actual Python objects\n        will not be copied recursively, only the reference to the object.\n        This is in contrast to `copy.deepcopy` in the Standard Library,\n        which recursively copies object data (see examples below).\n\n        While ``Index`` objects are copied when ``deep=True``, the underlying\n        numpy array is not copied for performance reasons. Since ``Index`` is\n        immutable, the underlying data can be safely shared and a copy\n        is not needed.\n\n        Examples\n        --------\n        >>> s = pd.Series([1, 2], index=["a", "b"])\n        >>> s\n        a    1\n        b    2\n        dtype: int64\n\n        >>> s_copy = s.copy()\n        >>> s_copy\n        a    1\n        b    2\n        dtype: int64\n\n        **Shallow copy versus default (deep) copy:**\n\n        >>> s = pd.Series([1, 2], index=["a", "b"])\n        >>> deep = s.copy()\n        >>> shallow = s.copy(deep=False)\n\n        Shallow copy shares data and index with original.\n\n        >>> s is shallow\n        False\n        >>> s.values is shallow.values and s.index is shallow.index\n        True\n\n        Deep copy has own copy of data and index.\n\n        >>> s is deep\n        False\n        >>> s.values is deep.values or s.index is deep.index\n        False\n\n        Updates to the data shared by shallow copy and original is reflected\n        in both; deep copy remains unchanged.\n\n        >>> s[0] = 3\n        >>> shallow[1] = 4\n        >>> s\n        a    3\n        b    4\n        dtype: int64\n        >>> shallow\n        a    3\n        b    4\n        dtype: int64\n        >>> deep\n        a    1\n        b    2\n        dtype: int64\n\n        Note that when copying an object containing Python objects, a deep copy\n        will copy the data, but will not do so recursively. Updating a nested\n        data object will be reflected in the deep copy.\n\n        >>> s = pd.Series([[1, 2], [3, 4]])\n        >>> deep = s.copy()\n        >>> s[0][0] = 10\n        >>> s\n        0    [10, 2]\n        1     [3, 4]\n        dtype: object\n        >>> deep\n        0    [10, 2]\n        1     [3, 4]\n        dtype: object\n        '
    data = self._data.copy(deep=deep)
    return self._constructor(data).__finalize__(self)
Make a copy of this object's indices and data.

When ``deep=True`` (default), a new object will be created with a
copy of the calling object's data and indices. Modifications to
the data or indices of the copy will not be reflected in the
original object (see notes below).

When ``deep=False``, a new object will be created without copying
the calling object's data or index (only references to the data
and index are copied). Any changes to the data of the original
will be reflected in the shallow copy (and vice versa).

Parameters
----------
deep : bool, default True
    Make a deep copy, including a copy of the data and the indices.
    With ``deep=False`` neither the indices nor the data are copied.

Returns
-------
copy : Series, DataFrame or Panel
    Object type matches caller.

Notes
-----
When ``deep=True``, data is copied but actual Python objects
will not be copied recursively, only the reference to the object.
This is in contrast to `copy.deepcopy` in the Standard Library,
which recursively copies object data (see examples below).

While ``Index`` objects are copied when ``deep=True``, the underlying
numpy array is not copied for performance reasons. Since ``Index`` is
immutable, the underlying data can be safely shared and a copy
is not needed.

Examples
--------
>>> s = pd.Series([1, 2], index=["a", "b"])
>>> s
a    1
b    2
dtype: int64

>>> s_copy = s.copy()
>>> s_copy
a    1
b    2
dtype: int64

**Shallow copy versus default (deep) copy:**

>>> s = pd.Series([1, 2], index=["a", "b"])
>>> deep = s.copy()
>>> shallow = s.copy(deep=False)

Shallow copy shares data and index with original.

>>> s is shallow
False
>>> s.values is shallow.values and s.index is shallow.index
True

Deep copy has own copy of data and index.

>>> s is deep
False
>>> s.values is deep.values or s.index is deep.index
False

Updates to the data shared by shallow copy and original is reflected
in both; deep copy remains unchanged.

>>> s[0] = 3
>>> shallow[1] = 4
>>> s
a    3
b    4
dtype: int64
>>> shallow
a    3
b    4
dtype: int64
>>> deep
a    1
b    2
dtype: int64

Note that when copying an object containing Python objects, a deep copy
will copy the data, but will not do so recursively. Updating a nested
data object will be reflected in the deep copy.

>>> s = pd.Series([[1, 2], [3, 4]])
>>> deep = s.copy()
>>> s[0][0] = 10
>>> s
0    [10, 2]
1     [3, 4]
dtype: object
>>> deep
0    [10, 2]
1     [3, 4]
dtype: object
def copy(self, deep=True):
    '\n        Make a copy of this object\'s indices and data.\n\n        When ``deep=True`` (default), a new object will be created with a\n        copy of the calling object\'s data and indices. Modifications to\n        the data or indices of the copy will not be reflected in the\n        original object (see notes below).\n\n        When ``deep=False``, a new object will be created without copying\n        the calling object\'s data or index (only references to the data\n        and index are copied). Any changes to the data of the original\n        will be reflected in the shallow copy (and vice versa).\n\n        Parameters\n        ----------\n        deep : bool, default True\n            Make a deep copy, including a copy of the data and the indices.\n            With ``deep=False`` neither the indices nor the data are copied.\n\n        Returns\n        -------\n        copy : Series, DataFrame or Panel\n            Object type matches caller.\n\n        Notes\n        -----\n        When ``deep=True``, data is copied but actual Python objects\n        will not be copied recursively, only the reference to the object.\n        This is in contrast to `copy.deepcopy` in the Standard Library,\n        which recursively copies object data (see examples below).\n\n        While ``Index`` objects are copied when ``deep=True``, the underlying\n        numpy array is not copied for performance reasons. Since ``Index`` is\n        immutable, the underlying data can be safely shared and a copy\n        is not needed.\n\n        Examples\n        --------\n        >>> s = pd.Series([1, 2], index=["a", "b"])\n        >>> s\n        a    1\n        b    2\n        dtype: int64\n\n        >>> s_copy = s.copy()\n        >>> s_copy\n        a    1\n        b    2\n        dtype: int64\n\n        **Shallow copy versus default (deep) copy:**\n\n        >>> s = pd.Series([1, 2], index=["a", "b"])\n        >>> deep = s.copy()\n        >>> shallow = s.copy(deep=False)\n\n        Shallow copy shares data and index with original.\n\n        >>> s is shallow\n        False\n        >>> s.values is shallow.values and s.index is shallow.index\n        True\n\n        Deep copy has own copy of data and index.\n\n        >>> s is deep\n        False\n        >>> s.values is deep.values or s.index is deep.index\n        False\n\n        Updates to the data shared by shallow copy and original is reflected\n        in both; deep copy remains unchanged.\n\n        >>> s[0] = 3\n        >>> shallow[1] = 4\n        >>> s\n        a    3\n        b    4\n        dtype: int64\n        >>> shallow\n        a    3\n        b    4\n        dtype: int64\n        >>> deep\n        a    1\n        b    2\n        dtype: int64\n\n        Note that when copying an object containing Python objects, a deep copy\n        will copy the data, but will not do so recursively. Updating a nested\n        data object will be reflected in the deep copy.\n\n        >>> s = pd.Series([[1, 2], [3, 4]])\n        >>> deep = s.copy()\n        >>> s[0][0] = 10\n        >>> s\n        0    [10, 2]\n        1     [3, 4]\n        dtype: object\n        >>> deep\n        0    [10, 2]\n        1     [3, 4]\n        dtype: object\n        '
    data = self._data.copy(deep=deep)
    return self._constructor(data).__finalize__(self)