Repository: geopandas/geopandas

Issue:
geoseries copy
As is mentioned in the [docstring](https://github.com/geopandas/geopandas/blob/master/geopandas/geoseries.py#L230:L237) of `geoseries.copy`:


```python
def copy(self, order='C'):
    """
    Make a copy of this GeoSeries object
    Parameters
    ----------
    deep : boolean, default True
        Make a deep copy, i.e. also copy data
    Returns
    -------
    copy : GeoSeries
    """
```

But this doesn't work:
```python
import geopandas
gs = geopandas.GeoSeries([1, 2, 3])
gs.copy(deep=True)
```
```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-69-6889712626ae> in <module>
      1 import geopandas
      2 gs = geopandas.GeoSeries([1, 2, 3])
----> 3 gs.copy(deep=True)

TypeError: copy() got an unexpected keyword argument 'deep'
```




Discussion:
Thanks for the report, the docstring and the actual function are indeed not matching. We can fix that, but from looking at the comment in the `GeoSeries.copy` implementation:

https://github.com/geopandas/geopandas/blob/8c42164559173972e7a4bafe705bbb2987d15d47/geopandas/geoseries.py#L246

it seems we can simply remove this function now (and directly inherit from pandas, which should have the correct docstring)

PRs always welcome!

Resolving patch:
diff --git a/geopandas/geodataframe.py b/geopandas/geodataframe.py
--- a/geopandas/geodataframe.py
+++ b/geopandas/geodataframe.py
@@ -52,12 +52,6 @@ class GeoDataFrame(GeoPandasBase, DataFrame):
         column on GeoDataFrame.
     """
 
-    # XXX: This will no longer be necessary in pandas 0.17
-    _internal_names = ['_data', '_cacher', '_item_cache', '_cache',
-                       'is_copy', '_subtyp', '_index',
-                       '_default_kind', '_default_fill_value', '_metadata',
-                       '__array_struct__', '__array_interface__']
-
     _metadata = ['crs', '_geometry_column_name']
 
     _geometry_column_name = DEFAULT_GEO_COLUMN_NAME
@@ -90,13 +84,6 @@ def __init__(self, *args, **kwargs):
             self.set_geometry(geometry, inplace=True)
         self._invalidate_sindex()
 
-    # Serialize metadata (will no longer be necessary in pandas 0.17+)
-    # See https://github.com/pydata/pandas/pull/10557
-    def __getstate__(self):
-        meta = dict((k, getattr(self, k, None)) for k in self._metadata)
-        return dict(_data=self._data, _typ=self._typ,
-                    _metadata=self._metadata, **meta)
-
     def __setattr__(self, attr, val):
         # have to special case geometry b/c pandas tries to use as column...
         if attr == 'geometry':
@@ -111,8 +98,7 @@ def _get_geometry(self):
         return self[self._geometry_column_name]
 
     def _set_geometry(self, col):
-        # TODO: Use pandas' core.common.is_list_like() here.
-        if not isinstance(col, (list, np.ndarray, Series)):
+        if not pd.api.types.is_list_like(col):
             raise ValueError("Must use a list-like to set the geometry"
                              " property")
         self.set_geometry(col, inplace=True)
@@ -587,25 +573,6 @@ def __finalize__(self, other, method=None, **kwargs):
                 object.__setattr__(self, name, getattr(other, name, None))
         return self
 
-    def copy(self, deep=True):
-        """
-        Make a copy of this GeoDataFrame object
-
-        Parameters
-        ----------
-        deep : boolean, default True
-            Make a deep copy, i.e. also copy data
-
-        Returns
-        -------
-        copy : GeoDataFrame
-        """
-        # FIXME: this will likely be unnecessary in pandas >= 0.13
-        data = self._data
-        if deep:
-            data = data.copy()
-        return GeoDataFrame(data).__finalize__(self)
-
     def plot(self, *args, **kwargs):
         """Generate a plot of the geometries in the ``GeoDataFrame``.
 
diff --git a/geopandas/geoseries.py b/geopandas/geoseries.py
--- a/geopandas/geoseries.py
+++ b/geopandas/geoseries.py
@@ -253,23 +253,6 @@ def __finalize__(self, other, method=None, **kwargs):
             object.__setattr__(self, name, getattr(other, name, None))
         return self
 
-    def copy(self, order='C'):
-        """
-        Make a copy of this GeoSeries object
-
-        Parameters
-        ----------
-        deep : boolean, default True
-            Make a deep copy, i.e. also copy data
-
-        Returns
-        -------
-        copy : GeoSeries
-        """
-        # FIXME: this will likely be unnecessary in pandas >= 0.13
-        return GeoSeries(self.values.copy(order), index=self.index,
-                      name=self.name).__finalize__(self)
-
     def isna(self):
         """
         Detect missing values.


Test patch: