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

Issue:
loc: label index does not raise KeyError with list of ints
I didn't expect the last line of code to pass.

```
import numpy as np
import pandas as pd

pd.__version__
#[Out]# '0.12.0.dev-5c3ccdb'

np.random.seed(33)
df = pd.DataFrame(np.random.random((3, 3)),
                  index=['a', 'b', 'c'],
                  columns=['e', 'f', 'g'])

# raise a KeyError?
df.loc[[1, 2], [1, 2]]
#[Out]#           f         g
#[Out]# b  0.870396  0.185040
#[Out]# c  0.953252  0.680451
```

Being strictly label based, shouldn't `loc` fail when it doesn't find 1 or 2 as a label?



Discussion:
that looks correct (in that it should raise), I think the comparison is backwards (and appartenly I am not testing it well enought).....marking this as a bug...thanks


Resolving patch:
diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py
--- a/pandas/core/indexing.py
+++ b/pandas/core/indexing.py
@@ -253,13 +253,13 @@ def _getitem_tuple(self, tup):
         except IndexingError:
             pass
 
+        # no multi-index, so validate all of the indexers
+        self._has_valid_tuple(tup)
+
         # ugly hack for GH #836
         if self._multi_take_opportunity(tup):
             return self._multi_take(tup)
 
-        # no multi-index, so validate all of the indexers
-        self._has_valid_tuple(tup)
-
         # no shortcut needed
         retval = self.obj
         for i, key in enumerate(tup):


Test patch:
diff --git a/pandas/tests/test_indexing.py b/pandas/tests/test_indexing.py
--- a/pandas/tests/test_indexing.py
+++ b/pandas/tests/test_indexing.py
@@ -483,6 +483,16 @@ def test_loc_getitem_int_slice(self):
         expected = df[10]
         assert_frame_equal(result,expected)
 
+    def test_loc_to_fail(self):
+
+        # GH3449
+        df = DataFrame(np.random.random((3, 3)),
+                       index=['a', 'b', 'c'],
+                       columns=['e', 'f', 'g'])
+
+        # raise a KeyError?
+        self.assertRaises(KeyError, df.loc.__getitem__, tuple([[1, 2], [1, 2]]))
+
     def test_loc_getitem_label_slice(self):
 
         # label slices (with ints)
Repository: pandas-dev/pandas

Issue:
Raise more helpful exception when concat() wrongly called as concat(obj1,obj2)
concat is supposed to be called with objs = a list or dict. Not multiple objects as as separate args. RIGHT: concat([df1,df2]) WRONG: concat(df1,df2)
The exception thrown in the latter case is seriously cryptic.

---

df1 = pd.DataFrame(randn(5,3), columns=['a','b','c'])
df2 = pd.DataFrame(randn(5,3), columns=['a','b','c'])
pd.concat(df1,df2)
... File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/core/frame.py", line 587, in **nonzero**
    raise ValueError("Cannot call bool() on DataFrame.")
## ValueError: Cannot call bool() on DataFrame.

Version: 0.10.1



Discussion:
yep...should fail fast, easy to raise if the objs is not a list or dict.....PR to fix?


Resolving patch:
diff --git a/pandas/tools/merge.py b/pandas/tools/merge.py
--- a/pandas/tools/merge.py
+++ b/pandas/tools/merge.py
@@ -888,6 +888,11 @@ class _Concatenator(object):
     def __init__(self, objs, axis=0, join='outer', join_axes=None,
                  keys=None, levels=None, names=None,
                  ignore_index=False, verify_integrity=False):
+        if not isinstance(objs, (tuple, list, dict)):
+            raise AssertionError('first argument must be a list of pandas '
+                                 'objects, you passed an object of type '
+                                 '"{0}"'.format(type(objs).__name__))
+
         if join == 'outer':
             self.intersect = False
         elif join == 'inner':


Test patch:
diff --git a/pandas/tools/tests/test_merge.py b/pandas/tools/tests/test_merge.py
--- a/pandas/tools/tests/test_merge.py
+++ b/pandas/tools/tests/test_merge.py
@@ -13,7 +13,8 @@
 from pandas.tseries.index import DatetimeIndex
 from pandas.tools.merge import merge, concat, ordered_merge, MergeError
 from pandas.util.testing import (assert_frame_equal, assert_series_equal,
-                                 assert_almost_equal, rands)
+                                 assert_almost_equal, rands,
+                                 makeCustomDataframe as mkdf)
 import pandas.algos as algos
 import pandas.util.testing as tm
 
@@ -1689,6 +1690,11 @@ def test_concat_series_axis1_same_names_ignore_index(self):
         result = concat([s1, s2], axis=1, ignore_index=True)
         self.assertTrue(np.array_equal(result.columns, [0, 1]))
 
+    def test_concat_invalid_first_argument(self):
+        df1 = mkdf(10, 2)
+        df2 = mkdf(10, 2)
+        self.assertRaises(AssertionError, concat, df1, df2)
+
 class TestOrderedMerge(unittest.TestCase):
 
     def setUp(self):
Repository: pandas-dev/pandas

Issue:
df.from_records should be consistent in handling empty `data` arg
carried over from #3487

``` python
DataFrame.from_records([], columns=['a','b','c'])

Empty DataFrame
Columns: [a, b, c]
Index: []
```

vs.

``` python
DataFrame.from_records([], columns=['a','b','b'])

AssertionError: Number of manager items must equal union of block items
```



Discussion:
yep....I think its a failure in the dup columns....will take a look


Resolving patch:
diff --git a/pandas/core/internals.py b/pandas/core/internals.py
--- a/pandas/core/internals.py
+++ b/pandas/core/internals.py
@@ -1960,7 +1960,8 @@ def form_blocks(arrays, names, axes):
     items = axes[0]
 
     if len(arrays) < len(items):
-        extra_items = items - Index(names)
+        nn = set(names)
+        extra_items = Index([ i for i in items if i not in nn ])
     else:
         extra_items = []
 


Test patch:
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -3518,6 +3518,16 @@ def test_from_records_misc_brokenness(self):
         results = df2_obj.get_dtype_counts()
         expected = Series({ 'datetime64[ns]' : 1, 'int64' : 1 })
 
+    def test_from_records_empty(self):
+        # 3562
+        result = DataFrame.from_records([], columns=['a','b','c'])
+        expected = DataFrame(columns=['a','b','c'])
+        assert_frame_equal(result, expected)
+
+        result = DataFrame.from_records([], columns=['a','b','b'])
+        expected = DataFrame(columns=['a','b','b'])
+        assert_frame_equal(result, expected)
+
     def test_to_records_floats(self):
         df = DataFrame(np.random.rand(10, 10))
         df.to_records()
Repository: pandas-dev/pandas

Issue:
grouby( ... , as_index=False) convert "float64" to "object" type.
``` 'python
In [1]: import pandas as pd 

In [2]: df = pd.DataFrame({"c1" : [1,2,6,6,8]})

In [3]: df["c2"] = df.c1/2.0

In [4]: df.groupby("c2").mean().reset_index().c2
Out[4]: 
0    0.5
1    1.0
2    3.0
3    4.0
Name: c2, dtype: float64

In [5]: df.groupby("c2", as_index=False).mean().c2
Out[5]: 
0    0.5
1      1
2      3
3      4
Name: c2, dtype: object

```

Note  the difference  in dtype between the two cases. 
I think the 2nd case shouldn't be different then the 1st case.



Discussion:
(On pandas 0.11.0)

this is a bug, thanks

as a work around, you can do:

```
In [11]: df.groupby("c2", as_index=False).mean().convert_objects().c2
Out[11]: 
0    0.5
1    1.0
2    3.0
3    4.0
Name: c2, dtype: float64
```


Resolving patch:
diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py
--- a/pandas/core/groupby.py
+++ b/pandas/core/groupby.py
@@ -1713,7 +1713,7 @@ def aggregate(self, arg, *args, **kwargs):
                 result.insert(0, name, values)
             result.index = np.arange(len(result))
 
-        return result
+        return result.convert_objects()
 
     def _aggregate_multiple_funcs(self, arg):
         from pandas.tools.merge import concat
@@ -2054,7 +2054,7 @@ def _wrap_aggregated_output(self, output, names=None):
         if self.axis == 1:
             result = result.T
 
-        return result
+        return result.convert_objects()
 
     def _wrap_agged_blocks(self, blocks):
         obj = self._obj_with_exclusions
@@ -2094,7 +2094,7 @@ def _wrap_agged_blocks(self, blocks):
         if self.axis == 1:
             result = result.T
 
-        return result
+        return result.convert_objects()
 
 
 from pandas.tools.plotting import boxplot_frame_groupby


Test patch:
diff --git a/pandas/tests/test_groupby.py b/pandas/tests/test_groupby.py
--- a/pandas/tests/test_groupby.py
+++ b/pandas/tests/test_groupby.py
@@ -1842,6 +1842,14 @@ def test_apply_with_mixed_dtype(self):
         result = df.apply(lambda x: x, axis=1)
         assert_series_equal(df.get_dtype_counts(), result.get_dtype_counts())
 
+
+        # GH 3610 incorrect dtype conversion with as_index=False
+        df = DataFrame({"c1" : [1,2,6,6,8]})
+        df["c2"] = df.c1/2.0
+        result1 = df.groupby("c2").mean().reset_index().c2
+        result2 = df.groupby("c2", as_index=False).mean().c2
+        assert_series_equal(result1,result2)
+
     def test_groupby_list_infer_array_like(self):
         result = self.df.groupby(list(self.df['A'])).mean()
         expected = self.df.groupby(self.df['A']).mean()
Repository: pandas-dev/pandas

Issue:
 Odd behavior from read_csv with na_values set to non-string values
read_csv behaves oddly when na_values is set to non-string values. Sometimes
it correctly replaces the assigned number with NaN, and sometimes it doesn't. Here are some examples. Note in particular the different behavior of the last two statements:
# Create file

df = DataFrame({'A' : [-999, 2, 3], 'B' : [1.2, -999, 4.5]})
df.to_csv('test2.csv', sep=' ', index=False)

print read_csv('test2.csv', sep= ' ', header=0, na_values=[-999])

---

A B
0 NaN 1.2
1 2 -999.0
## 2 3 4.5

print read_csv('test2.csv', sep= ' ', header=0, na_values=[-999.0])

---

A B
0 -999 1.2
1 2 NaN
## 2 3 4.5

print read_csv('test2.csv', sep= ' ', header=0, na_values=[-999.0,-999])

---

A B
0 -999 1.2
1 2 NaN
## 2 3 4.5

print read_csv('test2.csv', sep= ' ', header=0, na_values=[-999,-999.0])

---

A B
0 NaN 1.2
1 2 -999.0
## 2 3 4.5



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
@@ -1712,12 +1712,14 @@ def _clean_na_values(na_values, keep_default_na=True):
     else:
         if not com.is_list_like(na_values):
             na_values = [na_values]
-        na_values = set(list(na_values))
+        na_values = set(_stringify_na_values(na_values))
         if keep_default_na:
             na_values = na_values | _NA_VALUES
 
     return na_values
 
+def _stringify_na_values(na_values):
+    return [ str(x) for x in na_values ]
 
 def _clean_index_names(columns, index_col):
     if not _is_index_col(index_col):
@@ -1768,7 +1770,7 @@ def _get_empty_meta(columns, index_col, index_names):
 def _get_na_values(col, na_values):
     if isinstance(na_values, dict):
         if col in na_values:
-            return set(list(na_values[col]))
+            return set(_stringify_na_values(list(na_values[col])))
         else:
             return _NA_VALUES
     else:


Test patch:
diff --git a/pandas/io/tests/test_parsers.py b/pandas/io/tests/test_parsers.py
--- a/pandas/io/tests/test_parsers.py
+++ b/pandas/io/tests/test_parsers.py
@@ -498,6 +498,17 @@ def test_quoting(self):
         df = self.read_table(StringIO(good_line_small), sep='\t')
         self.assert_(len(df) == 3)
 
+    def test_non_string_na_values(self):
+        # GH3611, na_values that are not a string are an issue
+        with ensure_clean('__non_string_na_values__.csv') as path:
+            df = DataFrame({'A' : [-999, 2, 3], 'B' : [1.2, -999, 4.5]})
+            df.to_csv(path, sep=' ', index=False)
+            result1 = read_csv(path, sep= ' ', header=0, na_values=['-999.0','-999'])
+            result2 = read_csv(path, sep= ' ', header=0, na_values=[-999,-999.0])
+            result3 = read_csv(path, sep= ' ', header=0, na_values=[-999.0,-999])
+            tm.assert_frame_equal(result1,result2)
+            tm.assert_frame_equal(result2,result3)
+
     def test_custom_na_values(self):
         data = """A,B,C
 ignore,this,row
Repository: pandas-dev/pandas

Issue:
Panel.iloc[] broken
Panel.iloc[] doesn't index correctly given a mix of scalars and ranges

```
from pandas import Panel, date_range
from numpy.random import randn

p = Panel(randn(4, 4, 4))

print(p.iloc[:3, :3, :3].shape)
print(p.iloc[1, :3, :3].shape)
print(p.iloc[:3, 1, :3].shape)
print(p.iloc[:3, :3, 1].shape)
print(p.iloc[1, 1, :3].shape)
print(p.iloc[1, :3, 1].shape)
print(p.iloc[:3, 1, 1].shape)
```

Returns

```
[3, 3, 3]
(4, 3)
(4, 3)
(3, 3)
(3L,)
(4L,)
(4L,)
```



Discussion:
DataFrame.iloc is fine though:

```
print(p.iloc[1].iloc[:3, :3].shape)
```

Returns:

```
(3, 3)
```

As expected.


Resolving patch:
diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py
--- a/pandas/core/indexing.py
+++ b/pandas/core/indexing.py
@@ -778,8 +778,16 @@ def _has_valid_type(self, key, axis):
     def _getitem_tuple(self, tup):
 
         self._has_valid_tuple(tup)
+        try:
+            return self._getitem_lowerdim(tup)
+        except:
+            pass
+
         retval = self.obj
         for i, key in enumerate(tup):
+            if i >= self.obj.ndim:
+                raise IndexingError('Too many indexers')
+
             if _is_null_slice(key):
                 continue
 
diff --git a/pandas/core/panel.py b/pandas/core/panel.py
--- a/pandas/core/panel.py
+++ b/pandas/core/panel.py
@@ -326,7 +326,7 @@ def _init_arrays(self, arrays, arr_names, axes):
 
     @property
     def shape(self):
-        return [len(getattr(self, a)) for a in self._AXIS_ORDERS]
+        return tuple([len(getattr(self, a)) for a in self._AXIS_ORDERS])
 
     @classmethod
     def from_dict(cls, data, intersect=False, orient='items', dtype=None):


Test patch:
diff --git a/pandas/tests/test_indexing.py b/pandas/tests/test_indexing.py
--- a/pandas/tests/test_indexing.py
+++ b/pandas/tests/test_indexing.py
@@ -840,6 +840,19 @@ def test_set_index_nan(self):
         result = df.set_index(['year','PRuid','QC']).reset_index().reindex(columns=df.columns)
         assert_frame_equal(result,df)
 
+    def test_iloc_panel_issue(self):
+
+        # GH 3617
+        p = Panel(randn(4, 4, 4))
+
+        self.assert_(p.iloc[:3, :3, :3].shape == (3,3,3))
+        self.assert_(p.iloc[1, :3, :3].shape == (3,3))
+        self.assert_(p.iloc[:3, 1, :3].shape == (3,3))
+        self.assert_(p.iloc[:3, :3, 1].shape == (3,3))
+        self.assert_(p.iloc[1, 1, :3].shape == (3,))
+        self.assert_(p.iloc[1, :3, 1].shape == (3,))
+        self.assert_(p.iloc[:3, 1, 1].shape == (3,))
+      
 
 if __name__ == '__main__':
     import nose
Repository: pandas-dev/pandas

Issue:
Implement __nonzero__
It would be nice if dataframe instances implemented `__nonzero__` so you could test if a dataframe is empty or not as if it were a boolean.



Discussion:
This is pretty easy, but trying to rememeber if we there was a reason for not supporting this....

If you would like to do a PR (and see if anything else breaks)

(and prob should do this for Series and for NDFrame)

```
In [9]: def nonzero(frame):
   ...:     return len(frame) != 0
   ...: 

In [10]: DataFrame.__nonzero__ = DataFrame.__bool__ = nonzero

In [11]: print 'non-empty' if df else 'empty'
empty
```

Isn't there a `DataFrame.empty` property which does exactly this?

@cswegger yep there is, but this is actually a aslight API change


Resolving patch:
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -595,14 +595,6 @@ def shape(self):
 
     #----------------------------------------------------------------------
     # Class behavior
-
-    @property
-    def empty(self):
-        return not (len(self.columns) > 0 and len(self.index) > 0)
-
-    def __nonzero__(self):
-        raise ValueError("Cannot call bool() on DataFrame.")
-
     def _repr_fits_vertical_(self):
         """
         Check length against max_rows.
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -559,6 +559,13 @@ def __repr__(self):
     def values(self):
         return self._data.as_matrix()
 
+    @property
+    def empty(self):
+        return not all(len(ax) > 0 for ax in self.axes)
+
+    def __nonzero__(self):
+        return not self.empty
+
     @property
     def ndim(self):
         return self._data.ndim


Test patch:
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -10379,9 +10379,15 @@ def test_index_namedtuple(self):
         df = DataFrame([(1, 2), (3, 4)], index=index, columns=["A", "B"])
         self.assertEqual(df.ix[IndexType("foo", "bar")]["A"], 1)
 
-    def test_bool_raises_value_error_1069(self):
+    def test_bool_empty_nonzero(self):
         df = DataFrame([1, 2, 3])
-        self.failUnlessRaises(ValueError, lambda: bool(df))
+        self.assertTrue(bool(df))
+        self.assertFalse(df.empty)
+        df = DataFrame(index=['a', 'b'], columns=['c', 'd']).dropna()
+        self.assertFalse(bool(df))
+        self.assertFalse(bool(df.T))
+        self.assertTrue(df.empty)
+        self.assertTrue(df.T.empty)
 
     def test_any_all(self):
         self._check_bool_op('any', np.any, has_skipna=True, has_bool_only=True)
Repository: pandas-dev/pandas

Issue:
DataFrame.from_records doesn't get dtype from empty ndarray
``` python
a = np.array([(1, 2)], dtype=[('id', np.int64), ('value', np.int64)])
df = pd.DataFrame.from_records(a, index='id') # ok

b = np.array([], dtype=[('id', np.int64), ('value', np.int64)])
df = pd.DataFrame.from_records(b, index='id') # KeyError: 'id'
```

The cause is _to_arrays checks for empty data before understanding that ndarray was passed.



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
@@ -5756,7 +5756,11 @@ def _to_arrays(data, columns, coerce_float=False, dtype=None):
 
         return arrays, columns
 
-    if len(data) == 0:
+    if not len(data):
+        if isinstance(data, np.ndarray):
+            columns = data.dtype.names
+            if columns is not None:
+                return [[]] * len(columns), columns
         return [], []  # columns if columns is not None else []
     if isinstance(data[0], (list, tuple)):
         return _list_to_arrays(data, columns, coerce_float=coerce_float,


Test patch:
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -3522,6 +3522,18 @@ def test_from_records_empty(self):
         expected = DataFrame(columns=['a','b','b'])
         assert_frame_equal(result, expected)
 
+    def test_from_records_empty_with_nonempty_fields_gh3682(self):
+        a = np.array([(1, 2)], dtype=[('id', np.int64), ('value', np.int64)])
+        df = DataFrame.from_records(a, index='id')
+        assert_array_equal(df.index, Index([1], name='id'))
+        self.assertEqual(df.index.name, 'id')
+        assert_array_equal(df.columns, Index(['value']))
+
+        b = np.array([], dtype=[('id', np.int64), ('value', np.int64)])
+        df = DataFrame.from_records(b, index='id')
+        assert_array_equal(df.index, Index([], name='id'))
+        self.assertEqual(df.index.name, 'id')
+
     def test_to_records_floats(self):
         df = DataFrame(np.random.rand(10, 10))
         df.to_records()
Repository: pandas-dev/pandas

Issue:
minor doc issue: prevent ipython history cache warning in examples
http://pandas.pydata.org/pandas-docs/dev/timeseries.html#period



Discussion:
I saw this
any idea how to fix it?

yep u can turn off the cache, going to see if that works...i `grin`ed for `(Out|In)\[\d+\]` and got no uses of it in the console so i think it should be ok...i'm not sure if i get this in the same place when i build the docs locally. if it's there i haven't been able to find it

found it...trying to fix.


Resolving patch:
diff --git a/doc/sphinxext/ipython_directive.py b/doc/sphinxext/ipython_directive.py
--- a/doc/sphinxext/ipython_directive.py
+++ b/doc/sphinxext/ipython_directive.py
@@ -64,15 +64,8 @@
 import sys
 import tempfile
 
-# To keep compatibility with various python versions
-try:
-    from hashlib import md5
-except ImportError:
-    from md5 import md5
-
 # Third-party
 import matplotlib
-import sphinx
 from docutils.parsers.rst import directives
 from docutils import nodes
 from sphinx.util.compat import Directive
@@ -84,7 +77,6 @@
 from IPython.core.profiledir import ProfileDir
 from IPython.utils import io
 
-from pdb import set_trace
 
 #-----------------------------------------------------------------------------
 # Globals
@@ -205,6 +197,7 @@ def __init__(self):
         config.InteractiveShell.autocall = False
         config.InteractiveShell.autoindent = False
         config.InteractiveShell.colors = 'NoColor'
+        config.InteractiveShell.cache_size = 0
 
         # create a profile so instance history isn't saved
         tmp_profile_dir = tempfile.mkdtemp(prefix='profile_')


Test patch:
Repository: pandas-dev/pandas

Issue:
UnboundLocalError in _concat_single_item()
The exception handling code in _get_concatenated_data() relies on the exception not being generated in self._prepare_blocks() and can generate an exception with this non-informative error message:

```
Traceback (most recent call last):
  File "<pyshell#5>", line 12, in <module>
    df = pd.concat([activedf,closeddf])
  File "C:\Python27\lib\site-packages\pandas\tools\merge.py", line 873, in concat
    return op.get_result()
  File "C:\Python27\lib\site-packages\pandas\tools\merge.py", line 957, in get_result
    new_data = self._get_concatenated_data()
  File "C:\Python27\lib\site-packages\pandas\tools\merge.py", line 1001, in _get_concatenated_data
    new_data[item] = self._concat_single_item(rdata, item)
UnboundLocalError: local variable 'rdata' referenced before assignment
```



Discussion:
though I fixed this....just need to move the first statement outside of the try: except: PR?

yes, thanks; just wanted to report. sorry didn't find any previous report.

oh....it still looks like an error, what I meant was do you want to submit a PR to fix?

@stefan-pmc do you have a case that reproduces this?

@stefan-pmc if u provide the case i will fix :)

unless u want to submit a PR that is great too!

hard to supply the actual data but basically the error will happen for example if you try to do pd.concat() on a bunch of dataframes where one of them has an index with duplicates in it. if you move the first line outside the try block then it will generate the correct error message (cannot reindex with non unique index values), so that should do the job.
can submit a PR if that is of additional use and if you tell me what a PR is.

oh sorry :) a PR == pull request...do u need additional details about pull requests? happy to oblige!


Resolving patch:
diff --git a/pandas/tools/merge.py b/pandas/tools/merge.py
--- a/pandas/tools/merge.py
+++ b/pandas/tools/merge.py
@@ -984,11 +984,11 @@ def _prepare_blocks(self):
         return blockmaps, reindexed_data
 
     def _get_concatenated_data(self):
-        try:
-            # need to conform to same other (joined) axes for block join
-            blockmaps, rdata = self._prepare_blocks()
-            kinds = _get_all_block_kinds(blockmaps)
+        # need to conform to same other (joined) axes for block join
+        blockmaps, rdata = self._prepare_blocks()
+        kinds = _get_all_block_kinds(blockmaps)
 
+        try:
             new_blocks = []
             for kind in kinds:
                 klass_blocks = [mapping.get(kind) for mapping in blockmaps]


Test patch: