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

Issue:
Excel parser cannot change *keep_default_na* value
The parse method in the ExcelFile class does not pass the argument _keep_default_na_ to the TextParser from pandas.io.parsers.  There is no clean way to override the default na values when parsing excel files with the current code.

My specific problem involves "NA" as a typical value for "North America" in excel files.



Discussion:
@davidshinn I think #4139 should fix this - just changed `parse` and `_parse_excel` to pass keyword arguments through

@jtratner This fixes the problem perfectly and other potential kwds missing from upstream functions. I'm extremely impressed with the quick commits.  On another note, I noticed that because this doesn't specifically add the keyword argument, the feature is not as visible through ipython [tab completion](http://ipython.org/ipython-doc/stable/interactive/tutorial.html#tab-completion) and [introspection](http://ipython.org/ipython-doc/stable/interactive/tutorial.html#exploring-your-objects).  However from my perspective, the main issue is closed.  Maybe I'll tackle those niceties myself.  Thanks.

@davidshinn Especially now that ipython offers tab completion _on_ keyword arguments, I agree.  The sole issue with doing this is that it adds a little overhead to making sure that the default arguments of `TextParser` and `ExcelFile.parse` match up later on.


Resolving patch:
diff --git a/pandas/io/excel.py b/pandas/io/excel.py
--- a/pandas/io/excel.py
+++ b/pandas/io/excel.py
@@ -37,6 +37,11 @@ def read_excel(path_or_buf, sheetname, kind=None, **kwds):
           column ranges (e.g. "A:E" or "A,C,E:F")
     na_values : list-like, default None
         List of additional strings to recognize as NA/NaN
+    keep_default_na : bool, default True
+        If na_values are specified and keep_default_na is False the default NaN
+        values are overridden, otherwise they're appended to
+    verbose : boolean, default False
+        Indicate number of NA values placed in non-numeric columns
 
     Returns
     -------
@@ -101,6 +106,11 @@ def parse(self, sheetname, header=0, skiprows=None, skip_footer=0,
               column ranges (e.g. "A:E" or "A,C,E:F")
         na_values : list-like, default None
             List of additional strings to recognize as NA/NaN
+        keep_default_na : bool, default True
+            If na_values are specified and keep_default_na is False the default NaN
+            values are overridden, otherwise they're appended to
+        verbose : boolean, default False
+            Indicate number of NA values placed in non-numeric columns
 
         Returns
         -------


Test patch:
Repository: pandas-dev/pandas

Issue:
ENH: Series from MultiIndex causes segfault
```
In [3]: m = pd.MultiIndex.from_arrays([[1,2], [3,4]])

In [4]: m
Out[4]:
MultiIndex
[(1, 3), (2, 4)]

In [5]: pd.Series(m)
[1]    786 segmentation fault  ipython

pd.Series(m.values) has same fault (list of tuples)
```

Probably this should just be disallowed.



Discussion:
Perhaps this should return (not sure):

```
In [11]: m.to_series()
Out[11]:
1  3    (1, 3)
2  4    (2, 4)
dtype: object
```


Resolving patch:
diff --git a/pandas/core/series.py b/pandas/core/series.py
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -432,6 +432,9 @@ def __new__(cls, data=None, index=None, dtype=None, name=None,
         if data is None:
             data = {}
 
+        if isinstance(data, MultiIndex):
+            raise NotImplementedError
+
         if index is not None:
             index = _ensure_index(index)
 


Test patch:
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -311,6 +311,10 @@ def test_constructor(self):
         xp = 'Series'
         self.assertEqual(rs, xp)
 
+        # raise on MultiIndex GH4187
+        m = MultiIndex.from_arrays([[1, 2], [3,4]])
+        self.assertRaises(NotImplementedError, Series, m)
+
     def test_constructor_empty(self):
         empty = Series()
         empty2 = Series([])
Repository: pandas-dev/pandas

Issue:
1e69dad import failure
(master)[maye@luna4 ~/src/pandas]$ git log -1
commit 1e69dade1309b494e43f26f9831326c2ce63f7de
Merge: 5be1e5a 5b908a5
Author: Phillip Cloud cpcloud@gmail.com
Date:   Mon Jul 15 16:17:06 2013 -0700

```
Merge pull request #4248 from cpcloud/mpl-1.1.1-build

BLD: use mpl 1.1.1 in python 2.7 production travis build
```

This happened after doing:

``` python
python setup.py clean
python setup.py install
```

Here's the error:

``` python
In [1]: import pandas
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-d6ac987968b6> in <module>()
----> 1 import pandas

/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/pandas-0.12.0.dev_1e69dad-py2.7-macosx-10.5-x86_64.egg/pandas/__init__.pyc in <module>()
     25 import pandas.core.config_init
     26
---> 27 from pandas.core.api import *
     28 from pandas.sparse.api import *
     29 from pandas.stats.api import *

/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/pandas-0.12.0.dev_1e69dad-py2.7-macosx-10.5-x86_64.egg/pandas/core/api.py in <module>()
     16 from pandas.core.panel4d import Panel4D
     17 from pandas.core.groupby import groupby
---> 18 from pandas.core.reshape import (pivot_simple as pivot, get_dummies,
     19                                  lreshape)
     20

/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/pandas-0.12.0.dev_1e69dad-py2.7-macosx-10.5-x86_64.egg/pandas/core/reshape.py in <module>()
      6 import numpy as np
      7
----> 8 import six
      9
     10 from pandas.core.series import Series

ImportError: No module named six
```



Discussion:
FYI, 0.12.0.dev-6a0b9ec did not have this problem. (my last used version).

the commit of mine you've listed above touched nothing in the Python codebase. it changed only a travis build version of matplotlib which a typical user of pandas will never see (the travis stuff that is).

your last commit listed above on the other hand is 196 commits behind `master`. so maybe it was my fault, but if it was it certainly wasn't from the commit you've listed. 

try using `git diff` or better yet `git bisect` to see what has changed before raising an issue about it


Resolving patch:
diff --git a/pandas/core/reshape.py b/pandas/core/reshape.py
--- a/pandas/core/reshape.py
+++ b/pandas/core/reshape.py
@@ -5,8 +5,6 @@
 
 import numpy as np
 
-import six
-
 from pandas.core.series import Series
 from pandas.core.frame import DataFrame
 
@@ -691,7 +689,7 @@ def melt(frame, id_vars=None, value_vars=None,
         else:
             var_name = [frame.columns.name if frame.columns.name is not None
                         else 'variable']
-    if isinstance(var_name, six.string_types):
+    if isinstance(var_name, basestring):
         var_name = [var_name]
 
     N, K = frame.shape


Test patch:
Repository: pandas-dev/pandas

Issue:
Print skipped tests at the end of travis runs
Would be nice to know what is being skipped



Discussion:

Resolving patch:
diff --git a/ci/print_skipped.py b/ci/print_skipped.py
new file mode 100755
--- /dev/null
+++ b/ci/print_skipped.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+import sys
+import math
+import xml.etree.ElementTree as et
+
+
+def parse_results(filename):
+    tree = et.parse(filename)
+    root = tree.getroot()
+    skipped = []
+
+    current_class = old_class = ''
+    i = 1
+    assert i - 1 == len(skipped)
+    for el in root.findall('testcase'):
+        cn = el.attrib['classname']
+        for sk in el.findall('skipped'):
+            old_class = current_class
+            current_class = cn
+            name = '{classname}.{name}'.format(classname=current_class,
+                                               name=el.attrib['name'])
+            msg = sk.attrib['message']
+            out = ''
+            if old_class != current_class:
+                ndigits = int(math.log(i, 10) + 1)
+                out += ('-' * (len(name + msg) + 4 + ndigits) + '\n') # 4 for : + space + # + space
+            out += '#{i} {name}: {msg}'.format(i=i, name=name, msg=msg)
+            skipped.append(out)
+            i += 1
+            assert i - 1 == len(skipped)
+    assert i - 1 == len(skipped)
+    assert len(skipped) == int(root.attrib['skip'])
+    return '\n'.join(skipped)
+
+
+def main(args):
+    print('SKIPPED TESTS:')
+    print(parse_results(args.filename))
+    return 0
+
+
+def parse_args():
+    import argparse
+    parser = argparse.ArgumentParser()
+    parser.add_argument('filename', help='XUnit file to parse')
+    return parser.parse_args()
+
+
+if __name__ == '__main__':
+    sys.exit(main(parse_args()))


Test patch:
Repository: pandas-dev/pandas

Issue:
BUG: iat/at broken for PeriodIndex
```
In [9]: s = Series(randn(10), index=period_range('1/1/2001', periods=10))

In [10]: s
Out[10]:
2001-01-01   -0.677
2001-01-02    0.058
2001-01-03   -1.200
2001-01-04   -1.152
2001-01-05   -2.646
2001-01-06   -1.068
2001-01-07   -1.232
2001-01-08    0.452
2001-01-09    0.476
2001-01-10   -1.387
Freq: D, dtype: float64

In [11]: s.iat[0] # throws a KeyError
```



Discussion:
i guess this is ambiguous tho since period objects are really just fancy ints, still should work tho

@jreback should the conversion happen in the engine `get_value` in `index.pyx` or should there be check in the `ScalarIndexer` class for the `ordinal` attribute

no...the problem here is that the index is int based, so it tries to look up based the key (which is wrong)

i'll look at this


Resolving patch:
diff --git a/pandas/core/series.py b/pandas/core/series.py
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -1018,7 +1018,7 @@ def get_value(self, label):
         -------
         value : scalar value
         """
-        return self.index._engine.get_value(self, label)
+        return self.index.get_value(self, label)
 
     def set_value(self, label, value):
         """


Test patch:
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -629,7 +629,7 @@ def test_getitem_get(self):
         self.assertEqual(self.series[idx1], self.series[5])
         self.assertEqual(self.objSeries[idx2], self.objSeries[5])
 
-        self.assert_(self.series.get(-1) is None)
+        self.assertEqual(self.series.get(-1), self.series.get(self.series.index[-1]))
         self.assertEqual(self.series[5], self.series.get(self.series.index[5]))
 
         # missing
diff --git a/pandas/tseries/tests/test_period.py b/pandas/tseries/tests/test_period.py
--- a/pandas/tseries/tests/test_period.py
+++ b/pandas/tseries/tests/test_period.py
@@ -1323,6 +1323,15 @@ def test_as_frame_columns(self):
         ts = df['1/1/2000']
         assert_series_equal(ts, df.ix[:, 0])
 
+    def test_indexing(self):
+
+        # GH 4390, iat incorrectly indexing
+        index = period_range('1/1/2001', periods=10)
+        s = Series(randn(10), index=index)
+        expected = s[index[0]]
+        result = s.iat[0]
+        self.assert_(expected == result)
+
     def test_frame_setitem(self):
         rng = period_range('1/1/2000', periods=5)
         rng.name = 'index'
Repository: pandas-dev/pandas

Issue:
Panel attribute naming conflict if item is named 'a'
Including an item named 'a' breaks the expected attribute-retrieval behavior for Panels

```
import numpy as np
from pandas import DataFrame, Panel

df0 = DataFrame(np.zeros([3,4]))
df1 = DataFrame(np.ones([3,4]))

p = Panel({'a':df0, 'b':df1})

p.b
Out[6]: 
   0  1  2  3
0  1  1  1  1
1  1  1  1  1
2  1  1  1  1


p.a
Out[7]: 'minor_axis'
```

The expected behavior can be recovered by using anything other than 'a' itself:

```
p = Panel({'a_':df0, 'b':df1})
p.a_
Out[9]: 
   0  1  2  3
0  0  0  0  0
1  0  0  0  0
2  0  0  0  0
```

I'm guessing this is related to the fact that many Panel methods use `a` in iterating through the axes:

```
passed_axes = [kwargs.get(a) for a in self._AXIS_ORDERS]
```

Though it's not clear immediately which is the offending use, or if changing all of these is worth it for the recovery of the `a` namespace...



Discussion:
`i` is also aliased. I think because am setting up the axes using these as variables in a list comprehension, they get set as class variables (weird I think), this is going to change a bit anyhow (it will be a function instead of done directly in the class and hence won't be a problem)

I think that's a wart, i know I reach for 'a'/'b'/'c' as col names when I'm throwing up a test frame.

man python's scoping for loops is annoying sometimes. kind of an edge case though i think


Resolving patch:
diff --git a/pandas/core/panel.py b/pandas/core/panel.py
--- a/pandas/core/panel.py
+++ b/pandas/core/panel.py
@@ -165,12 +165,12 @@ class Panel(NDFrame):
     """
 
     _AXIS_ORDERS = ['items', 'major_axis', 'minor_axis']
-    _AXIS_NUMBERS = dict([(a, i) for i, a in enumerate(_AXIS_ORDERS)])
+    _AXIS_NUMBERS = dict((a, i) for i, a in enumerate(_AXIS_ORDERS))
     _AXIS_ALIASES = {
         'major': 'major_axis',
         'minor': 'minor_axis'
     }
-    _AXIS_NAMES = dict([(i, a) for i, a in enumerate(_AXIS_ORDERS)])
+    _AXIS_NAMES = dict(enumerate(_AXIS_ORDERS))
     _AXIS_SLICEMAP = {
         'major_axis': 'index',
         'minor_axis': 'columns'


Test patch:
diff --git a/pandas/tests/test_panel.py b/pandas/tests/test_panel.py
--- a/pandas/tests/test_panel.py
+++ b/pandas/tests/test_panel.py
@@ -1340,6 +1340,12 @@ def test_rename(self):
     def test_get_attr(self):
         assert_frame_equal(self.panel['ItemA'], self.panel.ItemA)
 
+        # specific cases from #3440
+        self.panel['a'] = self.panel['ItemA']
+        assert_frame_equal(self.panel['a'], self.panel.a)
+        self.panel['i'] = self.panel['ItemA']
+        assert_frame_equal(self.panel['i'], self.panel.i)
+
     def test_group_agg(self):
         values = np.ones((10, 2)) * np.arange(10).reshape((10, 1))
         bounds = np.arange(5) * 2
Repository: pandas-dev/pandas

Issue:
DOC: Update docs to reflect actual version support.
I don't think this is true anymore (from install.html on pandas site)

> Officially Python 2.6 to 2.7 and Python 3.1+, although Python 3 support is less well tested. Python 2.4 support is being phased out since the userbase has shrunk significantly. Continuing Python 2.4 support will require either monetary development support or someone contributing to the project to maintain compatibility.

I'm pretty sure that 2.4 (and 2.5) will fail, if only because the `from __future__ import with_statement` have been removed from many files.  I also think we're at the point where we can say that Python 3.1+ support is actually there (this could be a change in docs for  v0.13)



Discussion:
There's no testing for py 3.1. we can claim the usual suspects 2.6, 2.7, 3.2 and 3.3

3.1 might be even officially deprecated/buggy

just claim the usual suspects

:+1: on not supporting 3.1. 3.2 is going to be here to stay for a while given that it's the default for the newest Ubuntu LTS, right?


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -180,6 +180,10 @@ def build_extensions(self):
     'Programming Language :: Python',
     'Programming Language :: Python :: 2',
     'Programming Language :: Python :: 3',
+    'Programming Language :: Python :: 2.6',
+    'Programming Language :: Python :: 2.7',
+    'Programming Language :: Python :: 3.2',
+    'Programming Language :: Python :: 3.3',
     'Programming Language :: Cython',
     'Topic :: Scientific/Engineering',
 ]


Test patch:
Repository: pandas-dev/pandas

Issue:
BUG: read_clipboard fails on Windows since pandas 0.12
Since I updated pandas from version 0.11 to 0.12, read_clipboard fails:

```
import pandas as pd    
df = pd.read_clipboard()
```

Results in:

```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-6dead334eb54> in <module>()
----> 1 df = pd.read_clipboard()

C:\Python33\lib\site-packages\pandas\io\clipboard.py in read_clipboard(**kwargs)
     16     from pandas.io.parsers import read_table
     17     text = clipboard_get()
---> 18     return read_table(StringIO(text), **kwargs)
     19 
     20 

TypeError: initial_value must be str or None, not bytes
```

What I did was:
- Open a csv file in Excel 2010
- Copy a range of cells, including headers
- Perform read_clipboard in iPython Qt console as described in above code block

After downgrading to 0.11, this procedure worked fine again.

OS: Win7, 64bit
Python: v3.3.2 32-bit
Pandas: 0.12.0
Numpy: 1.7.1



Discussion:

Resolving patch:
diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py
--- a/pandas/compat/__init__.py
+++ b/pandas/compat/__init__.py
@@ -55,11 +55,11 @@
     def isidentifier(s):
         return s.isidentifier()
 
-    def str_to_bytes(s, encoding='ascii'):
-        return s.encode(encoding)
+    def str_to_bytes(s, encoding=None):
+        return s.encode(encoding or 'ascii')
 
-    def bytes_to_str(b, encoding='utf-8'):
-        return b.decode(encoding)
+    def bytes_to_str(b, encoding=None):
+        return b.decode(encoding or 'utf-8')
 
     # have to explicitly put builtins into the namespace
     range = range
diff --git a/pandas/io/clipboard.py b/pandas/io/clipboard.py
--- a/pandas/io/clipboard.py
+++ b/pandas/io/clipboard.py
@@ -1,4 +1,5 @@
 """ io on the clipboard """
+from pandas import compat, get_option
 from pandas.compat import StringIO
 
 def read_clipboard(**kwargs):  # pragma: no cover
@@ -15,6 +16,13 @@ def read_clipboard(**kwargs):  # pragma: no cover
     from pandas.util.clipboard import clipboard_get
     from pandas.io.parsers import read_table
     text = clipboard_get()
+
+    # try to decode (if needed on PY3)
+    if compat.PY3:
+        try:
+            text = compat.bytes_to_str(text,encoding=kwargs.get('encoding') or get_option('display.encoding'))
+        except:
+            pass
     return read_table(StringIO(text), **kwargs)
 
 


Test patch:
Repository: pandas-dev/pandas

Issue:
PythonParser::_check_thousands appears broken
This code appears broken:

```
    def _check_thousands(self, lines):
        if self.thousands is None:
            return lines
        nonnum = re.compile('[^-^0-9^%s^.]+' % self.thousands)
        ret = []
        for l in lines:
            rl = []
            for x in l:
                if (not isinstance(x, compat.string_types) or
                    self.thousands not in x or
                        nonnum.search(x.strip())):
                    rl.append(x)
                else:
                    rl.append(x.replace(',', ''))
            ret.append(rl)
        return ret
```

It looks like the `thousands` argument to the class is used to check if the value is "non numeric" but then a hard coded comma is used when actually performing the cleaning.

In addition to fixing this, I would recommend factoring out this method so that it can be used elsewhere.



Discussion:
Can you show a small test case where this isn't working? At that point you'd be halfway to a PR :smile: 


Resolving patch:
diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py
--- a/pandas/io/parsers.py
+++ b/pandas/io/parsers.py
@@ -1538,7 +1538,7 @@ def _check_thousands(self, lines):
                         nonnum.search(x.strip())):
                     rl.append(x)
                 else:
-                    rl.append(x.replace(',', ''))
+                    rl.append(x.replace(self.thousands, ''))
             ret.append(rl)
         return ret
 


Test patch:
diff --git a/pandas/io/tests/test_cparser.py b/pandas/io/tests/test_cparser.py
--- a/pandas/io/tests/test_cparser.py
+++ b/pandas/io/tests/test_cparser.py
@@ -19,7 +19,7 @@
 from pandas import DataFrame, Series, Index, isnull, MultiIndex
 import pandas.io.parsers as parsers
 from pandas.io.parsers import (read_csv, read_table, read_fwf,
-                               TextParser)
+                               TextParser, TextFileReader)
 from pandas.util.testing import (assert_almost_equal, assert_frame_equal,
                                  assert_series_equal, network)
 import pandas.lib as lib
@@ -132,6 +132,16 @@ def test_integer_thousands(self):
 
         expected = [123456, 12500]
         tm.assert_almost_equal(result[0], expected)
+        
+    def test_integer_thousands_alt(self):
+        data = '123.456\n12.500'
+
+        reader = TextFileReader(StringIO(data), delimiter=':',
+                            thousands='.', header=None)
+        result = reader.read()
+
+        expected = [123456, 12500]
+        tm.assert_almost_equal(result[0], expected)
 
     def test_skip_bad_lines(self):
         # too many lines, see #2430 for why
Repository: pandas-dev/pandas

Issue:
Unused (and undocumented) `kind` parameter in `read_excel`
closes #4563

Why does read_excel take a `kind` parameter at all? It gets passed to the `ExcelFile` constructor, set on the object and then (as far as I can tell) never gets used for anything.

This should either be removed from the signature (which doesn't affect anything, because it will be accepted into kwds anyways) or added into the docs and then actually used for something.

if we remove it, just need to add a:

``` python
# Remove this branch in 0.14
if 'kind' in kwargs:
   warnings.warn("Kind is deprecated and will be removed in a future version of pandas")
   kwargs.pop('kind')
```

Was not previously being used for anything anyways.



Discussion:
also needs to be removed from the `ExcelFile` constructor in io/parsers along with guard.


Resolving patch:
diff --git a/pandas/io/excel.py b/pandas/io/excel.py
--- a/pandas/io/excel.py
+++ b/pandas/io/excel.py
@@ -13,9 +13,10 @@
 from pandas import json
 from pandas.compat import map, zip, reduce, range, lrange
 import pandas.compat as compat
+from warnings import warn
 
 
-def read_excel(path_or_buf, sheetname, kind=None, **kwds):
+def read_excel(path_or_buf, sheetname, **kwds):
     """Read an Excel table into a pandas DataFrame
 
     Parameters
@@ -50,8 +51,11 @@ def read_excel(path_or_buf, sheetname, kind=None, **kwds):
     parsed : DataFrame
         DataFrame from the passed in Excel file
     """
-    return ExcelFile(path_or_buf, kind=kind).parse(sheetname=sheetname,
-                                                   kind=kind, **kwds)
+    if 'kind' in kwds:
+        kwds.pop('kind')
+        warn("kind keyword is no longer supported in read_excel and may be "
+             "removed in a future version", FutureWarning)
+    return ExcelFile(path_or_buf).parse(sheetname=sheetname, **kwds)
 
 
 class ExcelFile(object):
@@ -64,8 +68,7 @@ class ExcelFile(object):
     path : string or file-like object
         Path to xls or xlsx file
     """
-    def __init__(self, path_or_buf, kind=None, **kwds):
-        self.kind = kind
+    def __init__(self, path_or_buf, **kwds):
 
         import xlrd  # throw an ImportError if we need to
 
diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py
--- a/pandas/io/parsers.py
+++ b/pandas/io/parsers.py
@@ -1979,6 +1979,6 @@ def __init__(self, path):
         super(ExcelWriter, self).__init__(path)
 
 class ExcelFile(excel.ExcelFile):
-    def __init__(self, path_or_buf, kind=None, **kwds):
+    def __init__(self, path_or_buf, **kwds):
         warn("ExcelFile can now be imported from: pandas.io.excel", FutureWarning)
-        super(ExcelFile, self).__init__(path_or_buf, kind=kind, **kwds)
+        super(ExcelFile, self).__init__(path_or_buf, **kwds)


Test patch: