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

Issue:
DEPR: use_inf_as_null option not deprecated but removed
From PR #16972, apparently the old config was forgot to added back: https://github.com/pandas-dev/pandas/pull/16972/files#diff-bf1e3451cec528f37a6950523e97dfe9L410

```
In [24]: pd.set_option('use_inf_as_null', True)
...
OptionError: "No such keys(s): 'use_inf_as_null'"

In [25]: pd.options.mode.use_inf_as_null
...
KeyError: 'use_inf_as_null'
```

Those raise a deprecation warning instead



Discussion:
i deprecated this in the original PR
maybe got removed somehow

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
@@ -412,8 +412,11 @@ def use_inf_as_na_cb(key):
     _use_inf_as_na(key)
 
 
-cf.register_option('mode.use_inf_as_na', False, use_inf_as_na_doc,
-                   cb=use_inf_as_na_cb)
+with cf.config_prefix('mode'):
+    cf.register_option('use_inf_as_na', False, use_inf_as_na_doc,
+                       cb=use_inf_as_na_cb)
+    cf.register_option('use_inf_as_null', False, use_inf_as_null_doc,
+                       cb=use_inf_as_na_cb)
 
 cf.deprecate_option('mode.use_inf_as_null', msg=use_inf_as_null_doc,
                     rkey='mode.use_inf_as_na')


Test patch:
diff --git a/pandas/tests/series/test_missing.py b/pandas/tests/series/test_missing.py
--- a/pandas/tests/series/test_missing.py
+++ b/pandas/tests/series/test_missing.py
@@ -410,6 +410,22 @@ def test_isna_for_inf(self):
         tm.assert_series_equal(r, e)
         tm.assert_series_equal(dr, de)
 
+    @tm.capture_stdout
+    def test_isnull_for_inf_deprecated(self):
+        # gh-17115
+        s = Series(['a', np.inf, np.nan, 1.0])
+        with tm.assert_produces_warning(DeprecationWarning,
+                                        check_stacklevel=False):
+            pd.set_option('mode.use_inf_as_null', True)
+            r = s.isna()
+            dr = s.dropna()
+            pd.reset_option('mode.use_inf_as_null')
+
+        e = Series([False, True, True, False])
+        de = Series(['a', 1.0], index=[0, 3])
+        tm.assert_series_equal(r, e)
+        tm.assert_series_equal(dr, de)
+
     def test_fillna(self):
         ts = Series([0., 1., 2., 3., 4.], index=tm.makeDateIndex(5))
Repository: pandas-dev/pandas

Issue:
DEPS: drop bottleneck < 1.0
should prob address #9422 simultaneously.


Discussion:
cc @kwgoodman

Resolving patch:
diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py
--- a/pandas/core/nanops.py
+++ b/pandas/core/nanops.py
@@ -1,6 +1,8 @@
 import itertools
 import functools
 import operator
+import warnings
+from distutils.version import LooseVersion
 
 import numpy as np
 from pandas import compat
@@ -20,11 +22,24 @@
 from pandas.core.config import get_option
 from pandas.core.common import _values_from_object
 
+_BOTTLENECK_INSTALLED = False
+_MIN_BOTTLENECK_VERSION = '1.0.0'
+
 try:
     import bottleneck as bn
-    _BOTTLENECK_INSTALLED = True
+    ver = bn.__version__
+    _BOTTLENCK_INSTALLED = ver >= LooseVersion(_MIN_BOTTLENECK_VERSION)
+
+    if not _BOTTLENECK_INSTALLED:
+        warnings.warn(
+            "The installed version of bottleneck {ver} is not supported "
+            "in pandas and will be not be used\nThe minimum supported "
+            "version is {min_ver}\n".format(
+                ver=ver, min_ver=_MIN_BOTTLENECK_VERSION), UserWarning)
+
 except ImportError:  # pragma: no cover
-    _BOTTLENECK_INSTALLED = False
+    pass
+
 
 _USE_BOTTLENECK = False
 


Test patch:
Repository: pandas-dev/pandas

Issue:
AttributeError Block.items
https://github.com/pandas-dev/pandas/blob/master/pandas/core/internals.py#L326

`core.internals.Block` references `self.items`.  AFAICT `items` is an attribute of `BlockManager`, does not exist in `Block`.

```
ser = pd.Series(range(5))
mgr = ser._data
block = mgr.blocks[0]
>>> block.get(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/pandas/core/internals.py", line 329, in get
    loc = self.items.get_loc(item)
AttributeError: 'IntBlock' object has no attribute 'items'
```


Discussion:
I think this is dead code. We *always* use positional indexing on a block (e.g. ``.iget``). not sure why the linter doesn't find this. you can do a PR to remove.
Code coverage also indicates this is never used (at least in our tests)

Resolving patch:
diff --git a/pandas/core/internals.py b/pandas/core/internals.py
--- a/pandas/core/internals.py
+++ b/pandas/core/internals.py
@@ -323,10 +323,6 @@ def reindex_axis(self, indexer, method=None, axis=1, fill_value=None,
                                    fill_value=fill_value, mask_info=mask_info)
         return self.make_block(new_values, fastpath=True)
 
-    def get(self, item):
-        loc = self.items.get_loc(item)
-        return self.values[loc]
-
     def iget(self, i):
         return self.values[i]
 
@@ -1658,13 +1654,6 @@ def set(self, locs, values, check=False):
         assert locs.tolist() == [0]
         self.values = values
 
-    def get(self, item):
-        if self.ndim == 1:
-            loc = self.items.get_loc(item)
-            return self.values[loc]
-        else:
-            return self.values
-
     def putmask(self, mask, new, align=True, inplace=False, axis=0,
                 transpose=False, mgr=None):
         """
@@ -4722,8 +4711,6 @@ def _concat_indexes(indexes):
 
 def _block2d_to_blocknd(values, placement, shape, labels, ref_items):
     """ pivot to the labels shape """
-    from pandas.core.internals import make_block
-
     panel_shape = (len(placement),) + shape
 
     # TODO: lexsort depth needs to be 2!!


Test patch:
Repository: pandas-dev/pandas

Issue:
BUG: fillna returns frame when inplace=True if fill values are specified as a dict
`fillna` will return the frame in question if passed fill values via a dict, even if `inplace=True`.

```
In [6]: data = pd.DataFrame({'a': [1, None], 'b': [2, None]})

In [7]: data.fillna({'a': 0}, inplace=True)
Out[7]: 
     a    b
0  1.0  2.0
1  0.0  NaN

In [8]: data
Out[8]: 
     a    b
0  1.0  2.0
1  0.0  NaN

```


Discussion:
I noticed this because it comes up in [PR#15653](https://github.com/pandas-dev/pandas/pull/15653), where it causes the following test...

```python
        def _check_f(base, f):
            result = f(base)
            self.assertTrue(result is None)


        # fillna
        f = lambda x: x.fillna(0, inplace=True)
        _check_f(data.copy(), f)
```

...to fail.

Will fix there. *Should* be a one-liner.
yep this looks like a bug.
I'm working on this issue

Resolving patch:
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -4054,7 +4054,8 @@ def fillna(self, value=None, method=None, axis=None, inplace=False,
                         continue
                     obj = result[k]
                     obj.fillna(v, limit=limit, inplace=True, downcast=downcast)
-                return result
+                return result if not inplace else None
+
             elif not is_list_like(value):
                 new_data = self._data.fillna(value=value, limit=limit,
                                              inplace=inplace,


Test patch:
diff --git a/pandas/tests/frame/test_missing.py b/pandas/tests/frame/test_missing.py
--- a/pandas/tests/frame/test_missing.py
+++ b/pandas/tests/frame/test_missing.py
@@ -407,6 +407,9 @@ def test_fillna_inplace(self):
         df.fillna(value=0, inplace=True)
         tm.assert_frame_equal(df, expected)
 
+        expected = df.fillna(value={0: 0}, inplace=True)
+        assert expected is None
+
         df[1][:4] = np.nan
         df[3][-4:] = np.nan
         expected = df.fillna(method='ffill')
Repository: pandas-dev/pandas

Issue:
CLN: pyarrow 0.6.0 compat, we need to handle back-compat on this
 /home/travis/miniconda3/envs/pandas/lib/python3.6/site-packages/pyarrow/pandas_compat.py:248: FutureWarning: timestamps_to_ms=True is deprecated
    warnings.warn('timestamps_to_ms=True is deprecated', FutureWarning)



Discussion:
cc @wesm 
per discussion in https://github.com/apache/arrow/pull/1046, I think the correct fix is to remove usage of `timestamps_to_ms` in pandas and pass the right coercion option to `pyarrow.parquet.write_table`

Resolving patch:
diff --git a/pandas/io/parquet.py b/pandas/io/parquet.py
--- a/pandas/io/parquet.py
+++ b/pandas/io/parquet.py
@@ -58,13 +58,23 @@ def __init__(self):
                               "\nor via pip\n"
                               "pip install -U pyarrow\n")
 
+        self._pyarrow_lt_050 = LooseVersion(pyarrow.__version__) < '0.5.0'
+        self._pyarrow_lt_060 = LooseVersion(pyarrow.__version__) < '0.6.0'
         self.api = pyarrow
 
-    def write(self, df, path, compression='snappy', **kwargs):
+    def write(self, df, path, compression='snappy',
+              coerce_timestamps='ms', **kwargs):
         path, _, _ = get_filepath_or_buffer(path)
-        table = self.api.Table.from_pandas(df, timestamps_to_ms=True)
-        self.api.parquet.write_table(
-            table, path, compression=compression, **kwargs)
+        if self._pyarrow_lt_060:
+            table = self.api.Table.from_pandas(df, timestamps_to_ms=True)
+            self.api.parquet.write_table(
+                table, path, compression=compression, **kwargs)
+
+        else:
+            table = self.api.Table.from_pandas(df)
+            self.api.parquet.write_table(
+                table, path, compression=compression,
+                coerce_timestamps=coerce_timestamps, **kwargs)
 
     def read(self, path):
         path, _, _ = get_filepath_or_buffer(path)


Test patch:
Repository: pandas-dev/pandas

Issue:
ERR: better error message for trying to concat non-pandas objects
```
In [3]: pd.concat([Series(), 'foo'])
TypeError: cannot concatenate a non-NDFrame object
```

trivially ``non-NDFrame`` -> ``non-pandas``. but I think even better would be something like

```
In [4]: objs = [Series(), 'foo']

In [7]: "cannot concatenate [{pandas}] with non-pandas objects of type [{non_pandas}]".format(
   ...: pandas=','.join(set([str(o.__class__.__name__) for o in objs if isinstance(o, pandas.core.generic.NDFrame)])),
   ...: non_pandas=','.join(set([str(type(o)) for o in objs if not isinstance(o, pandas.core.generic.NDFrame)])))
Out[7]: "cannot concatenate [Series] with non-pandas objects of type [<class 'str'>]"
```


Discussion:
I would like to take care of this one. There could be more than two objects in the concatenation, so how about "cannot concatenate objects of type [<class 'str'>], all objects must be pandas objects"?
@petioptrv yes that's why I put the list comprehension and set things. Should work with many objects.

Its just meant to be more instructive to the user.
I think "pandas objects" is still a bit vague. Eg  an Index, or a Timestamp are also pandas objects, but cannot be concatenated. 
Are there other things than Series, DataFrame and Panel that can be concatenated? If not, let's just list those in the error message?

eg

```
TypeError: cannot only concatenate with Series, DataFrame or Panel objects, an object of type [<class 'str'>] was passed.
```
Looking at this.

Resolving patch:
diff --git a/pandas/core/reshape/concat.py b/pandas/core/reshape/concat.py
--- a/pandas/core/reshape/concat.py
+++ b/pandas/core/reshape/concat.py
@@ -262,7 +262,10 @@ def __init__(self, objs, axis=0, join='outer', join_axes=None,
         ndims = set()
         for obj in objs:
             if not isinstance(obj, NDFrame):
-                raise TypeError("cannot concatenate a non-NDFrame object")
+                msg = ('cannot concatenate object of type "{0}";'
+                       ' only pd.Series, pd.DataFrame, and pd.Panel'
+                       ' (deprecated) objs are valid'.format(type(obj)))
+                raise TypeError(msg)
 
             # consolidate
             obj._consolidate(inplace=True)


Test patch:
diff --git a/pandas/tests/reshape/test_concat.py b/pandas/tests/reshape/test_concat.py
--- a/pandas/tests/reshape/test_concat.py
+++ b/pandas/tests/reshape/test_concat.py
@@ -177,7 +177,9 @@ def test_concatlike_same_dtypes(self):
             tm.assert_series_equal(res, exp, check_index_type=True)
 
             # cannot append non-index
-            msg = "cannot concatenate a non-NDFrame object"
+            msg = ('cannot concatenate object of type \"(.+?)\";'
+                   ' only pd.Series, pd.DataFrame, and pd.Panel'
+                   ' \(deprecated\) objs are valid')
             with tm.assert_raises_regex(TypeError, msg):
                 pd.Series(vals1).append(vals2)
Repository: pandas-dev/pandas

Issue:
ERR: better error message on merging for incompat types
would be nice to have the types outputted in the error message

```
In [23]:         left = pd.DataFrame({'a': [1, 5, 10],
    ...:                              'left_val': ['a', 'b', 'c']})
    ...:         right = pd.DataFrame({'a': [1, 2, 3, 6, 7],
    ...:                               'right_val': [1, 2, 3, 6, 7]})
    ...: 
    ...: 

In [24]: pd.merge_asof(left, right, on='a')
Out[24]: 
    a left_val  right_val
0   1        a          1
1   5        b          3
2  10        c          7

In [25]: pd.merge_asof(left, right.assign(a=right.a.astype('i4')), on='a')
MergeError: incompatible merge keys, must be the same type
```


Discussion:
Hi,

I'm new to contributing to pandas and would love to take a crack at this!


Resolving patch:
diff --git a/pandas/core/reshape/merge.py b/pandas/core/reshape/merge.py
--- a/pandas/core/reshape/merge.py
+++ b/pandas/core/reshape/merge.py
@@ -1253,10 +1253,12 @@ def _get_merge_keys(self):
          join_names) = super(_AsOfMerge, self)._get_merge_keys()
 
         # validate index types are the same
-        for lk, rk in zip(left_join_keys, right_join_keys):
+        for i, (lk, rk) in enumerate(zip(left_join_keys, right_join_keys)):
             if not is_dtype_equal(lk.dtype, rk.dtype):
-                raise MergeError("incompatible merge keys, "
-                                 "must be the same type")
+                raise MergeError("incompatible merge keys [{i}] {lkdtype} and "
+                                 "{rkdtype}, must be the same type"
+                                 .format(i=i, lkdtype=lk.dtype,
+                                         rkdtype=rk.dtype))
 
         # validate tolerance; must be a Timedelta if we have a DTI
         if self.tolerance is not None:


Test patch:
diff --git a/pandas/tests/reshape/test_merge_asof.py b/pandas/tests/reshape/test_merge_asof.py
--- a/pandas/tests/reshape/test_merge_asof.py
+++ b/pandas/tests/reshape/test_merge_asof.py
@@ -973,3 +973,15 @@ def test_on_float_by_int(self):
             columns=['symbol', 'exch', 'price', 'mpv'])
 
         assert_frame_equal(result, expected)
+
+    def test_merge_datatype_error(self):
+        """ Tests merge datatype mismatch error """
+        msg = 'merge keys \[0\] object and int64, must be the same type'
+
+        left = pd.DataFrame({'left_val': [1, 5, 10],
+                             'a': ['a', 'b', 'c']})
+        right = pd.DataFrame({'right_val': [1, 2, 3, 6, 7],
+                              'a': [1, 2, 3, 6, 7]})
+
+        with tm.assert_raises_regex(MergeError, msg):
+            merge_asof(left, right, on='a')
Repository: pandas-dev/pandas

Issue:
one } too much
https://github.com/pandas-dev/pandas/blob/81372093f1fdc0c07e4b45ba0f47b0360fabd405/pandas/core/frame.py#L5116

should be   ...     df = df.append({'A': i}, ignore_index=True)
instead of   ...     df = df.append({'A'}: i}, ignore_index=True)

note the } after the 'A'


Discussion:

Resolving patch:
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -5105,7 +5105,7 @@ def append(self, other, ignore_index=False, verify_integrity=False):
 
         >>> df = pd.DataFrame(columns=['A'])
         >>> for i in range(5):
-        ...     df = df.append({'A'}: i}, ignore_index=True)
+        ...     df = df.append({'A': i}, ignore_index=True)
         >>> df
            A
         0  0


Test patch:
Repository: pandas-dev/pandas

Issue:
Not clear which window is default for df.rolling()
The docstring for `df.rolling()` doesn't say which window is the default (I assume it's boxcar?): https://pandas-docs.github.io/pandas-docs-travis/generated/pandas.DataFrame.rolling.html


Discussion:
the default is ``None``, you must actually specify a ``win_type`` for this to have an effect.
that said if you want to clarify the doc-string, would be ok.
The value `None` is clear as the default, but it doesn't say which window this corresponds to which seems to me to be quite important. (ie. if I pass `None`, what window does it use?)
@dstansby it doesn't, you must explicity specify. it if you want that 'kind' of window. Full documentation is: http://pandas.pydata.org/pandas-docs/stable/computation.html#rolling-windows

maybe should link to it.
You don't have to explicitly specify it - according to the docs window is an optional keyword argument

```python
import pandas as pd
import numpy as np

ser = pd.Series(np.random.randn(10), index=pd.date_range('1/1/2000', periods=10))

print(ser.rolling(window=5, win_type='boxcar').mean())
print(ser.rolling(window=5, win_type=None).mean())
```

Both of those print statements give the same thing, which means that `win_type=None` uses a boxcar window, but reading the docs I don't think there is any way of knowing that.

Resolving patch:
diff --git a/pandas/core/window.py b/pandas/core/window.py
--- a/pandas/core/window.py
+++ b/pandas/core/window.py
@@ -503,6 +503,9 @@ class Window(_Window):
     * ``general_gaussian`` (needs power, width)
     * ``slepian`` (needs width).
 
+    If ``win_type=None`` all points are evenly weighted. To learn more about
+    different window types see `scipy.signal window functions
+    <https://docs.scipy.org/doc/scipy/reference/signal.html#window-functions>`__.
     """
 
     def validate(self):


Test patch:
Repository: pandas-dev/pandas

Issue:
BUG: unstacking with object columns defaults to None as a fill value
```
In [41]: df = DataFrame({'A' : [1,1,2], 'B' : list('aba'), 'C' : ['foo', np.nan, 'bar']}).set_index(['A','B'])

In [42]: df.unstack('B')
Out[42]: 
     C      
B    a     b
A           
1  foo   NaN
2  bar  None

In [43]: df.unstack('B', fill_value=np.nan)
Out[43]: 
     C     
B    a    b
A          
1  foo  NaN
2  bar  NaN
```

Introduced is this PR: https://github.com/pydata/pandas/pull/10246

you can make a case to do this as we DO support `None` as a fill value, but almost always even with object columns we use `np.nan`, unless very explicity set by the user.



Discussion:
cc @amcpherson 

So the preferred functionality is?:

```
In [42]: df.unstack('B')
Out[42]: 
     C      
B    a     b
A           
1  foo  NaN
2  bar  NaN
```

default to `None` for object columns seems reasonable to me, but I can fix if `np.nan` is preferred.

yeah we just use nan even for object columns 
unless the user is very explicit about it

Hey folks, I'm happy to pick this up if no one else is working on it. I'm fairly confident with what needs to change (thanks for linking to the original PR, @jreback).
@mattayes please go ahead.

Resolving patch:
diff --git a/pandas/core/dtypes/cast.py b/pandas/core/dtypes/cast.py
--- a/pandas/core/dtypes/cast.py
+++ b/pandas/core/dtypes/cast.py
@@ -320,6 +320,7 @@ def maybe_promote(dtype, fill_value=np.nan):
             fill_value = iNaT
         else:
             dtype = np.object_
+            fill_value = np.nan
     else:
         dtype = np.object_
 


Test patch:
diff --git a/pandas/tests/frame/test_reshape.py b/pandas/tests/frame/test_reshape.py
--- a/pandas/tests/frame/test_reshape.py
+++ b/pandas/tests/frame/test_reshape.py
@@ -783,3 +783,26 @@ def test_stack_preserve_categorical_dtype(self):
                 expected = Series([10, 11, 12], index=midx)
 
                 tm.assert_series_equal(result, expected)
+
+
+def test_unstack_fill_frame_object():
+    # GH12815 Test unstacking with object.
+    data = pd.Series(['a', 'b', 'c', 'a'], dtype='object')
+    data.index = pd.MultiIndex.from_tuples(
+        [('x', 'a'), ('x', 'b'), ('y', 'b'), ('z', 'a')])
+
+    # By default missing values will be NaN
+    result = data.unstack()
+    expected = pd.DataFrame(
+        {'a': ['a', np.nan, 'a'], 'b': ['b', 'c', np.nan]},
+        index=list('xyz')
+    )
+    assert_frame_equal(result, expected)
+
+    # Fill with any value replaces missing values as expected
+    result = data.unstack(fill_value='d')
+    expected = pd.DataFrame(
+        {'a': ['a', 'd', 'a'], 'b': ['b', 'c', 'd']},
+        index=list('xyz')
+    )
+    assert_frame_equal(result, expected)
Repository: pandas-dev/pandas

Issue:
get_value_box duplication
`tslib.get_value_box` seems out of place.  The only place it is used is in `base.index`.  Meanwhile `_libs.index.get_value_at` looks very similar but is never used.  (It also looks similar to a chunk of code in `IndexEngine.get_value`

Is it possible that `index.get_value_at` was intended to replace `tslib.get_value_box`?


Discussion:
@jbrockmendel : Have a look at the blame tab on GitHub for this file.  That might be of use, though other maintainers probably know better than I here.

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
@@ -2559,7 +2559,7 @@ def get_value(self, series, key):
                 raise
 
             try:
-                return libts.get_value_box(s, key)
+                return libindex.get_value_box(s, key)
             except IndexError:
                 raise
             except TypeError:


Test patch:
Repository: pandas-dev/pandas

Issue:
Newline backslash stripped
In `read_csv` [documentation][0], there is an example: 

> For example, if comment=’#’, parsing ‘#emptyna,b,cn1,2,3’ with header=0 will result in ‘a,b,c’ being treated as the header.

Newlines have their backslashes stripped, because these examples are not encapsulated by double backticks.

Will submit a PR.

[0]: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html


Discussion:

Resolving patch:
diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py
--- a/pandas/io/parsers.py
+++ b/pandas/io/parsers.py
@@ -246,8 +246,8 @@
     of a line, the line will be ignored altogether. This parameter must be a
     single character. Like empty lines (as long as ``skip_blank_lines=True``),
     fully commented lines are ignored by the parameter `header` but not by
-    `skiprows`. For example, if comment='#', parsing '#empty\\na,b,c\\n1,2,3'
-    with `header=0` will result in 'a,b,c' being
+    `skiprows`. For example, if ``comment='#'``, parsing
+    ``#empty\\na,b,c\\n1,2,3`` with ``header=0`` will result in 'a,b,c' being
     treated as the header.
 encoding : str, default None
     Encoding to use for UTF when reading/writing (ex. 'utf-8'). `List of Python


Test patch: