internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: pandas-dev/pandas

Issue:
Fix type annotations in pandas.core.base
Part of #25882 

pandas.core.base has the following mypy errors:
```
pandas/core/base.py:840: error: "IndexOpsMixin" has no attribute "_values"; maybe "_map_values"?
pandas/core/base.py:963: error: "IndexOpsMixin" has no attribute "values"
```

Pull request to follow


Discussion:

Resolving patch:
diff --git a/pandas/core/base.py b/pandas/core/base.py
--- a/pandas/core/base.py
+++ b/pandas/core/base.py
@@ -837,7 +837,10 @@ def array(self) -> ExtensionArray:
         [a, b, a]
         Categories (2, object): [a, b]
         """
-        result = self._values
+        # As a mixin, we depend on the mixing class having _values.
+        # Special mixin syntax may be developed in the future:
+        # https://github.com/python/typing/issues/246
+        result = self._values  # type: ignore
 
         if is_datetime64_ns_dtype(result.dtype):
             from pandas.arrays import DatetimeArray
@@ -960,7 +963,10 @@ def _ndarray_values(self) -> np.ndarray:
         """
         if is_extension_array_dtype(self):
             return self.array._ndarray_values
-        return self.values
+        # As a mixin, we depend on the mixing class having values.
+        # Special mixin syntax may be developed in the future:
+        # https://github.com/python/typing/issues/246
+        return self.values  # type: ignore
 
     @property
     def empty(self):


Test patch:
Repository: pandas-dev/pandas

Issue:
Fix type annotations in pandas.core.base
- [X] closes #26296
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`



Discussion:

Resolving patch:
diff --git a/pandas/core/config_init.py b/pandas/core/config_init.py
--- a/pandas/core/config_init.py
+++ b/pandas/core/config_init.py
@@ -277,8 +277,6 @@ def use_numexpr_cb(key):
     Valid values: False,True
 """
 
-style_backup = dict()
-
 
 def table_schema_cb(key):
     from pandas.io.formats.printing import _enable_data_resource_formatter


Test patch:
Repository: pandas-dev/pandas

Issue:
Links on resample documentation page are broken
I meant to open an issue about inconsistent behaviour of resampling for sub- and super-daily intervals. When I was almost done, I discovered it's already been reported/discussed #9586

Figuring all of this out myself wasted a couple of hours, that could have been saved by a clearer documentation on the `resample` page: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.resample.html

Some things to change here:
* The links under *Notes* are "broken" in a sense that the headers on the page they link to seem to be non-existing anymore. I guess the link labeled *this link* should go here: http://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#dateoffset-objects  I'm unsure to which header *user guide* should link to.
* The docstring for the `rule` parameter is confusing. It's type annotation says it's supposed to be a `str` but the description is *The offset string or object representing target conversion.* What kind of object can it be if not a string? And shouldn't this be in the type annotation then? Is it possible to link to some more information on this directly from the description of the parameter so it becomes immediately clear what the options are?


Discussion:
PRs to improve documentation are always welcome if you'd like to work on this!

Resolving patch:
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -7917,7 +7917,7 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
 
         Parameters
         ----------
-        rule : str
+        rule : DateOffset, Timedelta or str
             The offset string or object representing target conversion.
         how : str
             Method for down/re-sampling, default to 'mean' for downsampling.
@@ -7985,11 +7985,11 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
         Notes
         -----
         See the `user guide
-        <http://pandas.pydata.org/pandas-docs/stable/timeseries.html#resampling>`_
+        <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#resampling>`_
         for more.
 
         To learn more about the offset strings, please see `this link
-        <http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases>`__.
+        <http://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#dateoffset-objects>`__.
 
         Examples
         --------


Test patch:
Repository: pandas-dev/pandas

Issue:
Fix type annotations for pandas.core.indexes.base
Part of #25882 

Current errors are:

    pandas\core\indexes\base.py:9: error: Module 'pandas._libs' has no attribute 'join'


Discussion:
The line with the error is:

    from pandas._libs import (
        algos as libalgos, index as libindex, join as libjoin, lib)

A `join.pyx` file does exists in the `_libs` directory but mypy is still giving error. The other imports `algos`, `index` and `lib` are also `.pyx` file but there is no error for them.
@WillAyd some help here please. Do we need a `.pyi` file?
You can just move the join as alias to a separate line - Mypy doesn’t seem to like that all being on one line and we’ve done that elsewhere
@WillAyd you mean like this? :point_down: 

    from pandas._libs import (
        algos as libalgos, index as libindex, lib)
    from pandas._libs import join as libjoin
No matter how I import it makes no difference. Still same error.
That’s right 

Sent from my iPhone

> On May 13, 2019, at 6:46 AM, Vaibhav Vishal <notifications@github.com> wrote:
> 
> @WillAyd you mean like this? 👇
> 
> from pandas._libs import (
>     algos as libalgos, index as libindex, lib)
> from pandas._libs import join as libjoin
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or mute the thread.

Try `import pandas._libs.join as libjoin`.

Resolving patch:
diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py
--- a/pandas/core/indexes/base.py
+++ b/pandas/core/indexes/base.py
@@ -6,8 +6,8 @@
 
 import numpy as np
 
-from pandas._libs import (
-    algos as libalgos, index as libindex, join as libjoin, lib)
+from pandas._libs import algos as libalgos, index as libindex, lib
+import pandas._libs.join as libjoin
 from pandas._libs.lib import is_datetime_array
 from pandas._libs.tslibs import OutOfBoundsDatetime, Timedelta, Timestamp
 from pandas._libs.tslibs.timezones import tz_compare


Test patch:
Repository: pandas-dev/pandas

Issue:
GroupBy nth ignores observed keyword for Categorical
Was looking to consolidate nth, first and last in the GroupBy world but was hitting some issues with categorical tests and handling of missing data. Note that the following calls are not equivalent, though they should be:

```python
>>> import numpy as np
>>> import pandas as pd

>>> s1 = pd.Categorical([np.nan, 'a', np.nan, 'a'], categories=['a', 'b', 'c'])
>>> s2 = pd.Series([1, 2, 3, 4])
>>> df = pd.DataFrame({'s1': s1, 's2': s2})
>>> grp = df.groupby('s1', observed=False)
>>> grp.first()
     s2
s1
a   2.0
b   NaN
c   NaN

>>> grp.nth(0)
    s2
s1
a    2
```



Discussion:
I get the output - 

```python
>>> grp.nth(0)
     s2
s1    
a    2
c    1
```

Resolving patch:
diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py
--- a/pandas/core/groupby/groupby.py
+++ b/pandas/core/groupby/groupby.py
@@ -1773,7 +1773,11 @@ def nth(self, n: Union[int, List[int]], dropna: Optional[str] = None) -> DataFra
             if not self.as_index:
                 return out
 
-            out.index = self.grouper.result_index[ids[mask]]
+            result_index = self.grouper.result_index
+            out.index = result_index[ids[mask]]
+
+            if not self.observed and isinstance(result_index, CategoricalIndex):
+                out = out.reindex(result_index)
 
             return out.sort_index() if self.sort else out
 


Test patch:
diff --git a/pandas/tests/groupby/test_categorical.py b/pandas/tests/groupby/test_categorical.py
--- a/pandas/tests/groupby/test_categorical.py
+++ b/pandas/tests/groupby/test_categorical.py
@@ -434,6 +434,21 @@ def test_observed_groups_with_nan(observed):
     tm.assert_dict_equal(result, expected)
 
 
+def test_observed_nth():
+    # GH 26385
+    cat = pd.Categorical(["a", np.nan, np.nan], categories=["a", "b", "c"])
+    ser = pd.Series([1, 2, 3])
+    df = pd.DataFrame({"cat": cat, "ser": ser})
+
+    result = df.groupby("cat", observed=False)["ser"].nth(0)
+
+    index = pd.Categorical(["a", "b", "c"], categories=["a", "b", "c"])
+    expected = pd.Series([1, np.nan, np.nan], index=index, name="ser")
+    expected.index.name = "cat"
+
+    tm.assert_series_equal(result, expected)
+
+
 def test_dataframe_categorical_with_nan(observed):
     # GH 21151
     s1 = Categorical([np.nan, "a", np.nan, "a"], categories=["a", "b", "c"])
Repository: pandas-dev/pandas

Issue:
Deprecate py.path support
Since our min version is Py35 path lib is guaranteed to be installed. However we have a few functions that accept py.path.LocalPath objects for compatability

Not sure if we need an explicit deprecation cycle or if this is implied with moving minimum support to Py35


Discussion:
we should deprecate as have accepted these for a long time and they work py 3
If possible, I'd like to contribute to this. Should I search for functions with LocalPath and deprecate them accordingly?
@nandahkrishna that's great! And yes you've got it right. You might want to check out other PRs labeled Deprecate that have been merged to see how we typically handle as well
> You might want to check out other PRs labeled Deprecate that have been merged to see how we typically handle as well

Sure, I'll do that. Thanks!
I took a look at previous PRs labeled deprecate. I got a fair idea of how it works, but I couldn't seem to find a case that deprecated an external library (might have missed my eye?) so just confirming:
1. Visit functions where py.path.local has been used
2. Add a DeprecateWarning with a suitable message
3. Add tests for the warning
Is this right?
That's right!

Resolving patch:
diff --git a/pandas/io/common.py b/pandas/io/common.py
--- a/pandas/io/common.py
+++ b/pandas/io/common.py
@@ -9,6 +9,7 @@
 import lzma
 import mmap
 import os
+import pathlib
 from urllib.error import URLError  # noqa
 from urllib.parse import (  # noqa
     urlencode, urljoin, urlparse as parse_url, uses_netloc, uses_params,
@@ -115,24 +116,10 @@ def _stringify_path(filepath_or_buffer):
     Any other object is passed through unchanged, which includes bytes,
     strings, buffers, or anything else that's not even path-like.
     """
-    try:
-        import pathlib
-        _PATHLIB_INSTALLED = True
-    except ImportError:
-        _PATHLIB_INSTALLED = False
-
-    try:
-        from py.path import local as LocalPath
-        _PY_PATH_INSTALLED = True
-    except ImportError:
-        _PY_PATH_INSTALLED = False
-
     if hasattr(filepath_or_buffer, '__fspath__'):
         return filepath_or_buffer.__fspath__()
-    if _PATHLIB_INSTALLED and isinstance(filepath_or_buffer, pathlib.Path):
+    elif isinstance(filepath_or_buffer, pathlib.Path):
         return str(filepath_or_buffer)
-    if _PY_PATH_INSTALLED and isinstance(filepath_or_buffer, LocalPath):
-        return filepath_or_buffer.strpath
     return _expand_user(filepath_or_buffer)
 
 


Test patch:
Repository: pandas-dev/pandas

Issue:
Fix type annotations in pandas.core.indexes.period
Part of #25882 

Current errors are:

    pandas\core\indexes\period.py:171: error: Incompatible types in assignment (expression has type "PeriodArray", base class "DatetimeIndexOpsMixin" defined the type as "None")


Discussion:

Resolving patch:
diff --git a/pandas/core/indexes/period.py b/pandas/core/indexes/period.py
--- a/pandas/core/indexes/period.py
+++ b/pandas/core/indexes/period.py
@@ -80,7 +80,7 @@ class PeriodIndex(DatetimeIndexOpsMixin, Int64Index, PeriodDelegateMixin):
 
     Parameters
     ----------
-    data : array-like (1-dimensional), optional
+    data : array-like (1d integer np.ndarray or PeriodArray), optional
         Optional period-like data to construct index with
     copy : bool
         Make a copy of input ndarray
@@ -168,7 +168,7 @@ class PeriodIndex(DatetimeIndexOpsMixin, Int64Index, PeriodDelegateMixin):
     _is_numeric_dtype = False
     _infer_as_myclass = True
 
-    _data = None  # type: PeriodArray
+    _data = None
 
     _engine_type = libindex.PeriodEngine
 


Test patch:
Repository: pandas-dev/pandas

Issue:
CI - Azure: print skipped tests
We have a `ci/print_skipped.py` script to print the skipped tests, that is currently used in Travis (see end of `.travis.yml` file). It would be to also do this in Azure as an extra step.


Discussion:

Resolving patch:
diff --git a/ci/print_skipped.py b/ci/print_skipped.py
--- a/ci/print_skipped.py
+++ b/ci/print_skipped.py
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 
+import os
 import sys
 import math
 import xml.etree.ElementTree as et
@@ -36,19 +37,19 @@ def parse_results(filename):
     return '\n'.join(skipped)
 
 
-def main(args):
+def main():
+    test_files = [
+        'test-data-single.xml',
+        'test-data-multiple.xml',
+        'test-data.xml',
+    ]
+
     print('SKIPPED TESTS:')
-    for fn in args.filename:
-        print(parse_results(fn))
+    for fn in test_files:
+        if os.path.isfile(fn):
+            print(parse_results(fn))
     return 0
 
 
-def parse_args():
-    import argparse
-    parser = argparse.ArgumentParser()
-    parser.add_argument('filename', nargs='+', help='XUnit file to parse')
-    return parser.parse_args()
-
-
 if __name__ == '__main__':
-    sys.exit(main(parse_args()))
+    sys.exit(main())


Test patch:
Repository: pandas-dev/pandas

Issue:
Broken benchmarks
The benchmarks are currently broken, and are making red the CI of all PRs that modify something in `asv_bench` (we run the CI check for benchmarks when something is modified in that directory).

This has probably been caused by #26225. But it's strange that the CI for that PR wasn't red, since it run the benchmark checks.

This is blocking #26414, #26703. The error can be seen here: https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=12407

```
[ 16.10%] ··· ...ervalIndexMethod.time_intersection_duplicate         1/3 failed
[ 16.10%] ··· ========== ==========
                param1             
              ---------- ----------
                 1000     1.76±0ms 
                100000    73.3±0ms 
               10000000    failed  
              ========== ==========
```


Discussion:
Taking a look now.
It appears this large `N` never worked. I have a fix that yields a large speedup (`~10x+`) but possibly changes the intent of this benchmark: https://github.com/pandas-dev/pandas/pull/26711

Resolving patch:
diff --git a/asv_bench/benchmarks/index_object.py b/asv_bench/benchmarks/index_object.py
--- a/asv_bench/benchmarks/index_object.py
+++ b/asv_bench/benchmarks/index_object.py
@@ -188,7 +188,7 @@ def time_get_loc(self):
 
 class IntervalIndexMethod:
     # GH 24813
-    params = [10**3, 10**5, 10**7]
+    params = [10**3, 10**5]
 
     def setup(self, N):
         left = np.append(np.arange(N), np.array(0))


Test patch:
Repository: pandas-dev/pandas

Issue:
Rolling with win_type='triang' strange results
in my env(mac, python3.6.1,pandas0.23.4)

```python
In [26]: df = pd.DataFrame({'B': [0, 1, 2, np.nan, 4]})
In [27]: df
Out[27]:
B
0 0.0
1 1.0
2 2.0
3 NaN
4 4.0

In [28]: df.rolling(2, win_type='triang').sum()
Out[28]:
B
0 NaN
1 0.5
2 1.5
3 NaN
4 NaN

In [29]: df.rolling(2, win_type='triang').mean()
Out[29]:
B
0 NaN
1 0.5
2 1.5
3 NaN
4 NaN
```

but in the docs,

```python
df.rolling(2, win_type='triang').sum()
B
0 NaN
1 1.0
2 2.5
3 NaN
4 NaN
```

q1: docs.sum and myenv.sum is different
q2:sum()'result is the same as means()'result


Discussion:
What docs?
I assume these are the docs the OP is referring to:

https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.rolling.html

@WangWenQiang in the future please use syntax highlighting when posting code as it makes it easier to read (I've done it for you this time around)
Might be quite a few issues here. I don't think the docs are correct, but I also don't think that `triang` should be returning the same value for `mean` and `sum`. 

Investigation and PRs certainly welcome
@WillAyd I guess it is normal to get same results for `sum` and `mean` while using `triang` with window size 2. From [this line](https://github.com/pandas-dev/pandas/blob/v0.24.2/pandas/_libs/window.pyx#L1721), it seems sum means `sum(weights * values)` for each window. Since weights are `[0.5, 0.5]` for `signal.windows.triang(2)`, they are equivalent and there is nothing wrong. I can fix the document if it is ok.

Resolving patch:
diff --git a/pandas/core/window.py b/pandas/core/window.py
--- a/pandas/core/window.py
+++ b/pandas/core/window.py
@@ -530,8 +530,8 @@ class Window(_Window):
     >>> df.rolling(2, win_type='triang').sum()
          B
     0  NaN
-    1  1.0
-    2  2.5
+    1  0.5
+    2  1.5
     3  NaN
     4  NaN
 


Test patch:
Repository: pandas-dev/pandas

Issue:
BUG: Series.Count() miscounts NA values in ExtensionArrays
#### Code Sample, a copy-pastable example if possible

```python
In [9]: import numpy as np
   ...: import pandas as np
   ...: from pandas.tests.extension.decimal.array import to_decimal
   ...: ser = pd.Series(to_decimal([1,2,3]))
   ...: ser[0]=np.nan
   ...: ser.count()
3
```



Discussion:

Resolving patch:
diff --git a/pandas/core/series.py b/pandas/core/series.py
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -1651,7 +1651,7 @@ def count(self, level=None):
         2
         """
         if level is None:
-            return notna(com.values_from_object(self)).sum()
+            return notna(self.array).sum()
 
         if isinstance(level, str):
             level = self.index._get_level_number(level)


Test patch:
diff --git a/pandas/tests/extension/base/methods.py b/pandas/tests/extension/base/methods.py
--- a/pandas/tests/extension/base/methods.py
+++ b/pandas/tests/extension/base/methods.py
@@ -30,6 +30,13 @@ def test_count(self, data_missing):
         expected = pd.Series([0, 1])
         self.assert_series_equal(result, expected)
 
+    def test_series_count(self, data_missing):
+        # GH#26835
+        ser = pd.Series(data_missing)
+        result = ser.count()
+        expected = 1
+        assert result == expected
+
     def test_apply_simple_series(self, data):
         result = pd.Series(data).apply(id)
         assert isinstance(result, pd.Series)
Repository: pandas-dev/pandas

Issue:
modfy[SparseArray] raises
```python
In [1]: import pandas as pd; import numpy as np

In [2]:         sparse = pd.SparseArray([0.0, 3.5], fill_value=0.0)
   ...:         r1, r2 = np.modf(sparse)
   ...:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-1f85037f7dc7> in <module>
      1 sparse = pd.SparseArray([0.0, 3.5], fill_value=0.0)
----> 2 r1, r2 = np.modf(sparse)

~/sandbox/pandas/pandas/core/arrays/sparse.py in __array_ufunc__(self, ufunc, method, *inputs, **kwargs)
   1700             return self._simple_new(sp_values,
   1701                                     self.sp_index,
-> 1702                                     SparseDtype(sp_values.dtype, fill_value))
   1703
   1704         result = getattr(ufunc, method)(*[np.asarray(x) for x in inputs],

AttributeError: 'tuple' object has no attribute 'dtype'


```

PR coming soon.


Discussion:

Resolving patch:
diff --git a/pandas/core/arrays/sparse.py b/pandas/core/arrays/sparse.py
--- a/pandas/core/arrays/sparse.py
+++ b/pandas/core/arrays/sparse.py
@@ -1697,6 +1697,17 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
             # No alignment necessary.
             sp_values = getattr(ufunc, method)(self.sp_values, **kwargs)
             fill_value = getattr(ufunc, method)(self.fill_value, **kwargs)
+
+            if isinstance(sp_values, tuple):
+                # multiple outputs. e.g. modf
+                arrays = tuple(
+                    self._simple_new(sp_value,
+                                     self.sp_index,
+                                     SparseDtype(sp_value.dtype, fv))
+                    for sp_value, fv in zip(sp_values, fill_value)
+                )
+                return arrays
+
             return self._simple_new(sp_values,
                                     self.sp_index,
                                     SparseDtype(sp_values.dtype, fill_value))


Test patch:
diff --git a/pandas/tests/arrays/sparse/test_array.py b/pandas/tests/arrays/sparse/test_array.py
--- a/pandas/tests/arrays/sparse/test_array.py
+++ b/pandas/tests/arrays/sparse/test_array.py
@@ -1071,6 +1071,16 @@ def test_ufunc_args(self):
         result = SparseArray([2, 0, 1, -1], fill_value=1)
         tm.assert_sp_array_equal(np.add(sparse, 1), result)
 
+    @pytest.mark.parametrize('fill_value', [0.0, np.nan])
+    def test_modf(self, fill_value):
+        # https://github.com/pandas-dev/pandas/issues/26946
+        sparse = pd.SparseArray([fill_value] * 10 + [1.1, 2.2],
+                                fill_value=fill_value)
+        r1, r2 = np.modf(sparse)
+        e1, e2 = np.modf(np.asarray(sparse))
+        tm.assert_sp_array_equal(r1, pd.SparseArray(e1, fill_value=fill_value))
+        tm.assert_sp_array_equal(r2, pd.SparseArray(e2, fill_value=fill_value))
+
     def test_nbytes_integer(self):
         arr = SparseArray([1, 0, 0, 0, 2], kind='integer')
         result = arr.nbytes
Repository: pandas-dev/pandas

Issue:
Show astype example with dict in docs
It would be useful to be able to change a column dtype inline.

For example with a DataFrame-level astype() overload:
Assuming `df` has a column called `str_col` that is a string (object),
`df.astype(col='str_col', dtype='int').head()`

The use case that brought me here is to numerically sort a string column without permanently changing it. What I was hoping to do is
`df.astype(col='str_col', dtype='int').sort_values(by='str_col')`

Instead, I had to do this:
`df = df.assign(int_col = lambda x: x['str_col'].astype('int')).sort_values(by='int_col').drop('int_col', axis = 'columns')`

The method would also support dictionaries for multiple column type changes:
`df.astype({'col1':'type1', 'col2':'type2'})`


Discussion:
DataFrame.astype already accepts a dictionary of columns to dtypes, your last form. IMO, accepting `**kwargs` makes sense because it conflicts with other keyword arguments.
I hadn't noticed that! Thanks Tom. I see it in the documentation now, though perhaps it would be good to include at least one code example in the doc showing the dictionary form. I agree it's better to keep it in **kwargs even for one column to keep the method signature streamlined.
@stevennic improvements to documentation are almost always welcome. Would you like to make a PR?
Sure, that'll be my compensation for taking up resources here :)

Resolving patch:
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -5622,6 +5622,31 @@ def astype(self, dtype, copy=True, errors='raise', **kwargs):
 
         Examples
         --------
+        Create a DataFrame:
+
+        >>> d = {'col1': [1, 2], 'col2': [3, 4]}
+        >>> df = pd.DataFrame(data=d)
+        >>> df.dtypes
+        col1    int64
+        col2    int64
+        dtype: object
+
+        Cast all columns to int32:
+
+        >>> df.astype('int32').dtypes
+        col1    int32
+        col2    int32
+        dtype: object
+
+        Cast col1 to int32 using a dictionary:
+
+        >>> df.astype({'col1': 'int32'}).dtypes
+        col1    int32
+        col2    int64
+        dtype: object
+
+        Create a series:
+
         >>> ser = pd.Series([1, 2], dtype='int32')
         >>> ser
         0    1


Test patch: