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

Issue:
DOC: add print statement in to_latex example
The docstring of `to_latext` shows a small example (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_latex.html) as 

```
>>> df = pd.DataFrame({'name': ['Raphael', 'Donatello'],
...                    'mask': ['red', 'purple'],
...                    'weapon': ['sai', 'bo staff']})
>>> df.to_latex(index=False) # doctest: +NORMALIZE_WHITESPACE
'\\begin{tabular}{lll}\n\\toprule\n      name &    mask &    weapon
\\\\\n\\midrule\n   Raphael &     red &       sai \\\\\n Donatello &
 purple &  bo staff \\\\\n\\bottomrule\n\\end{tabular}\n'
```

I think it would be nice to also add a print statement like `print(df.to_latex(index=False))`(typically you want to be able to copy it to your tex file, and so you first need to print it to have something you can copy paste)


Discussion:

Resolving patch:
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -2993,10 +2993,15 @@ def to_latex(
         >>> df = pd.DataFrame({'name': ['Raphael', 'Donatello'],
         ...                    'mask': ['red', 'purple'],
         ...                    'weapon': ['sai', 'bo staff']})
-        >>> df.to_latex(index=False) # doctest: +NORMALIZE_WHITESPACE
-        '\\begin{tabular}{lll}\n\\toprule\n      name &    mask &    weapon
-        \\\\\n\\midrule\n   Raphael &     red &       sai \\\\\n Donatello &
-         purple &  bo staff \\\\\n\\bottomrule\n\\end{tabular}\n'
+        >>> print(df.to_latex(index=False)) # doctest: +NORMALIZE_WHITESPACE
+        \begin{tabular}{lll}
+         \toprule
+               name &    mask &    weapon \\
+         \midrule
+            Raphael &     red &       sai \\
+          Donatello &  purple &  bo staff \\
+        \bottomrule
+        \end{tabular}
         """
         # Get defaults from the pandas config
         if self.ndim == 1:


Test patch:
Repository: pandas-dev/pandas

Issue:
DOC: Series.str.slice() should show that negative values for start are allowed
#### Code Sample, a copy-pastable example if possible

```python
In [1]: import pandas as pd

In [2]: pd.__version__
Out[2]: '0.25.0'

In [3]: s = pd.Series(["A1", "BC2", "DEF3"])

In [4]: s
Out[4]:
0      A1
1     BC2
2    DEF3
dtype: object

In [5]: s.str.slice(start=-1)
Out[5]:
0    1
1    2
2    3
dtype: object

In [6]: s.str[:-1]
Out[6]:
0      A
1     BC
2    DEF
dtype: object

```
#### Problem description

It is not apparent from the documentation at https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.slice.html that you can specify negative values for the `start` and `stop` arguments.  So I think this should be stated, as well as used in some examples (as shown above).

#### Expected Output

N/A

#### Output of ``pd.show_versions()``

N/A


Discussion:

Resolving patch:
diff --git a/pandas/core/strings.py b/pandas/core/strings.py
--- a/pandas/core/strings.py
+++ b/pandas/core/strings.py
@@ -1442,6 +1442,12 @@ def str_slice(arr, start=None, stop=None, step=None):
     2    hameleon
     dtype: object
 
+    >>> s.str.slice(start=-1)
+    0           a
+    1           x
+    2           n
+    dtype: object
+
     >>> s.str.slice(stop=2)
     0    ko
     1    fo


Test patch:
Repository: pandas-dev/pandas

Issue:
DOC: Standardize use of "Iterate" and "Iterator" in the documentation for DataFrame and Series iterators
Documentation for `DataFrame.items()` and `DataFrame.iteritems()` say 
"Iterator over..."
while other iterators for `DataFrame` and `Series` say
"Iterate over..."

All of these methods return an iterator, so I think it would make sense to have them all say "Iterator over...", although the documentation for 4/6 of the iteration methods already use "Iterate over...".

I'm not sure if there are other methods that also create iterators that we can use to justify one over the other.

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.items.html
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iteritems.html
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iterrows.html
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.itertuples.html
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.items.html
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.iteritems.html


Discussion:
According to our docstring guidelines, the sentence should start with an infinite verb: https://dev.pandas.io/development/contributing_docstring.html#section-1-short-summary

So according to that it should be "Iterate over .." or "Return iterator over .." ?

Resolving patch:
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -770,7 +770,7 @@ def style(self):
     _shared_docs[
         "items"
     ] = r"""
-        Iterator over (column name, Series) pairs.
+        Iterate over (column name, Series) pairs.
 
         Iterates over the DataFrame columns, returning a tuple with
         the column name and the content as a Series.


Test patch:
Repository: pandas-dev/pandas

Issue:
DOC: Use of "Yields" vs "Returns" for documentation of DataFrame.items() and DataFrame.iteritems() 
`DataFrame.items()` says it "Yields" the label and content of the columns whereas `DataFrame.iteritems()` says it "Returns" the label and content of the columns

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.items.html
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iteritems.html


Discussion:
Yields is the correct one. 
There is some discussion about this here: https://github.com/pandas-dev/pandas/pull/26114#discussion_r302264466

cc @topper-123 

Resolving patch:
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -775,7 +775,8 @@ def style(self):
         Iterates over the DataFrame columns, returning a tuple with
         the column name and the content as a Series.
 
-        %s
+        Yields
+        ------
         label : object
             The column names for the DataFrame being iterated over.
         content : Series
@@ -816,7 +817,7 @@ def style(self):
         Name: population, dtype: int64
         """
 
-    @Appender(_shared_docs["items"] % "Yields\n        ------")
+    @Appender(_shared_docs["items"])
     def items(self):
         if self.columns.is_unique and hasattr(self, "_item_cache"):
             for k in self.columns:
@@ -825,9 +826,9 @@ def items(self):
             for i, k in enumerate(self.columns):
                 yield k, self._ixs(i, axis=1)
 
-    @Appender(_shared_docs["items"] % "Returns\n        -------")
+    @Appender(_shared_docs["items"])
     def iteritems(self):
-        return self.items()
+        yield from self.items()
 
     def iterrows(self):
         """


Test patch:
Repository: pandas-dev/pandas

Issue:
DOC: Documentation says Series.items(), Series.iteritems() are equivalent to DataFrame.items(), but they're not.
Documentation says `Series.items()`, `Series.iteritems()` are equivalent to `DataFrame.items()` for DataFrames, but they're not. Instead, they are equivalent to `DataFrame.iterrows()`

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.items.html

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.iteritems.html

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.items.html

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iterrows.html


Discussion:
I think this is more a semantic discussion about what "equivalent" means here, but feel free to propose a better description of the relation between `Series.items()` and `DataFrame.items()`
Right. They're equivalent in the sense that you get an iterator over "key, value" pairs.

I think this is fine, but would certainly accept a PR clarifying things. I don't think we necessarily need an open issue for 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
@@ -1681,7 +1681,8 @@ def items(self):
 
         See Also
         --------
-        DataFrame.items : Equivalent to Series.items for DataFrame.
+        DataFrame.items : Iterate over (column name, Series) pairs.
+        DataFrame.iterrows : Iterate over DataFrame rows as (index, Series) pairs.
 
         Examples
         --------


Test patch:
Repository: pandas-dev/pandas

Issue:
DOC: See also for DataFrame.iterrows() should say Dataframe.x() instead of just .x()
See also for DataFrame.iterrows() currently has a "See also" section that lists
```
itertuples
items
```
while DataFrame.itertuples() shows
```
DataFrame.iterrows
DataFrame.items
```
We should change DataFrame.iterrows() to be like DataFrame.itertuples()

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iterrows.html
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.itertuples.html


Discussion:
Do you want to do a PR do change this?
If this issue is not assigned I would like to make PR for this :)
I'm not working on it. Go for it!

Resolving patch:
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -845,8 +845,8 @@ def iterrows(self):
 
         See Also
         --------
-        itertuples : Iterate over DataFrame rows as namedtuples of the values.
-        items : Iterate over (column name, Series) pairs.
+        DataFrame.itertuples : Iterate over DataFrame rows as namedtuples of the values.
+        DataFrame.items : Iterate over (column name, Series) pairs.
 
         Notes
         -----


Test patch:
Repository: pandas-dev/pandas

Issue:
BUG: cannot set Series with reverse slicer
Minimal example:
```
>>> import pandas as pd
>>> s = pd.Series(index=range(2010, 2020))
>>> s.loc[2015:2010:-1] = [6, 5, 4, 3, 2, 1]
Traceback (most recent call last):
[...]
ValueError: cannot set using a slice indexer with a different length than the value
```

I see no reason why this shouldn't work, as setting with the forward slicer works without problems, and *getting* with the reverse slicer also works without issue:
```
>>> # turn list around because slicer is (not) reversed compared to above
>>> s.loc[2010:2015] = [6, 5, 4, 3, 2, 1][::-1]
>>> s
2010    1.0
2011    2.0
2012    3.0
2013    4.0
2014    5.0
2015    6.0
2016    NaN
2017    NaN
2018    NaN
2019    NaN
dtype: float64
>>> s.loc[2015:2010:-1] == [6, 5, 4, 3, 2, 1]  # comparison, not assignment
2015    True
2014    True
2013    True
2012    True
2011    True
2010    True
dtype: bool
```

PS: For the failure, it does not matter if the RHS is a np.array, etc.



Discussion:
can I try it?
Sure, thanks.

On Thu, Aug 15, 2019 at 10:17 PM kmin-jeong <notifications@github.com>
wrote:

> can I try it?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/issues/26939?email_source=notifications&email_token=AAKAOIVUYC6UPJGLYUEX65LQEYL3LA5CNFSM4HZIJBZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4NRRUA#issuecomment-521869520>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAKAOIS7VDSD6W53V2S2X43QEYL3LANCNFSM4HZIJBZA>
> .
>


Resolving patch:
diff --git a/pandas/core/indexers.py b/pandas/core/indexers.py
--- a/pandas/core/indexers.py
+++ b/pandas/core/indexers.py
@@ -226,6 +226,7 @@ def length_of_indexer(indexer, target=None) -> int:
         if step is None:
             step = 1
         elif step < 0:
+            start, stop = stop + 1, start + 1
             step = -step
         return (stop - start + step - 1) // step
     elif isinstance(indexer, (ABCSeries, ABCIndexClass, np.ndarray, list)):


Test patch:
diff --git a/pandas/tests/indexing/test_loc.py b/pandas/tests/indexing/test_loc.py
--- a/pandas/tests/indexing/test_loc.py
+++ b/pandas/tests/indexing/test_loc.py
@@ -1070,6 +1070,16 @@ def test_series_indexing_zerodim_np_array(self):
         result = s.loc[np.array(0)]
         assert result == 1
 
+    def test_loc_reverse_assignment(self):
+        # GH26939
+        data = [1, 2, 3, 4, 5, 6] + [None] * 4
+        expected = Series(data, index=range(2010, 2020))
+
+        result = pd.Series(index=range(2010, 2020))
+        result.loc[2015:2010:-1] = [6, 5, 4, 3, 2, 1]
+
+        tm.assert_series_equal(result, expected)
+
 
 def test_series_loc_getitem_label_list_missing_values():
     # gh-11428
Repository: pandas-dev/pandas

Issue:
Docstring in pickle_compat.py out of date
#### Problem description

This docstring https://github.com/pandas-dev/pandas/blob/master/pandas/compat/pickle_compat.py#L196-L201 no longer applies as the `compat` kwarg is no longer present






Discussion:

Resolving patch:
diff --git a/pandas/compat/pickle_compat.py b/pandas/compat/pickle_compat.py
--- a/pandas/compat/pickle_compat.py
+++ b/pandas/compat/pickle_compat.py
@@ -196,10 +196,6 @@ def load_newobj_ex(self):
 def load(fh, encoding=None, is_verbose=False):
     """load a pickle, with a provided encoding
 
-    if compat is True:
-       fake the old class hierarchy
-       if it works, then return the new type objects
-
     Parameters
     ----------
     fh : a filelike object


Test patch:
Repository: pandas-dev/pandas

Issue:
unable to set xticks within bar() plotting function
#### Code Sample, a copy-pastable example if possible

In the code below:

``` python
pd.Series(range(10), index=range(10)).plot.bar(xticks=range(0, 11, 2))
```

`xticks` argument has no effect.  However, there's no such problem in line() plot.
#### Expected Output

Output plot is expected to have xticks defined by `xticks` argument, e.g. in the example above it should be set to [0, 2, 4, 6, 8, 10].
#### output of `pd.show_versions()`

commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 23.0.0
Cython: None
numpy: 1.11.1
scipy: 0.17.1
statsmodels: None
xarray: 0.8.1
IPython: 5.0.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None



Discussion:
We'd need to decide what to do if `len(series)` isn't equal to `len(xticks)`, I assume matplotlib will just throw and error, which is probably fine.

Mind stepping through `tools/plotting.py` to see what's going on?

At first glance it doesn't look very straightforward. I'll look more closely a bit later.


Resolving patch:
diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py
--- a/pandas/plotting/_matplotlib/core.py
+++ b/pandas/plotting/_matplotlib/core.py
@@ -1435,8 +1435,13 @@ def _post_plot_logic(self, ax, data):
 
     def _decorate_ticks(self, ax, name, ticklabels, start_edge, end_edge):
         ax.set_xlim((start_edge, end_edge))
-        ax.set_xticks(self.tick_pos)
-        ax.set_xticklabels(ticklabels)
+
+        if self.xticks is not None:
+            ax.set_xticks(np.array(self.xticks))
+        else:
+            ax.set_xticks(self.tick_pos)
+            ax.set_xticklabels(ticklabels)
+
         if name is not None and self.use_index:
             ax.set_xlabel(name)
 


Test patch:
diff --git a/pandas/tests/plotting/test_series.py b/pandas/tests/plotting/test_series.py
--- a/pandas/tests/plotting/test_series.py
+++ b/pandas/tests/plotting/test_series.py
@@ -871,6 +871,13 @@ def test_xticklabels(self):
         exp = ["P{i:02d}".format(i=i) for i in [0, 3, 5, 9]]
         self._check_text_labels(ax.get_xticklabels(), exp)
 
+    def test_xtick_barPlot(self):
+        # GH28172
+        s = pd.Series(range(10), index=["P{i:02d}".format(i=i) for i in range(10)])
+        ax = s.plot.bar(xticks=range(0, 11, 2))
+        exp = np.array(list(range(0, 11, 2)))
+        tm.assert_numpy_array_equal(exp, ax.get_xticks())
+
     def test_custom_business_day_freq(self):
         # GH7222
         from pandas.tseries.offsets import CustomBusinessDay
Repository: pandas-dev/pandas

Issue:
Series.append raises TypeError with tuple of Series
mypy error: 
```
pandas\core\series.py:2733:25: error: Unsupported operand types for + ("List[Any]" and "Tuple[Any, ...]")
pandas\core\series.py:2733:25: note: Right operand is of type "Union[List[Any], Tuple[Any, ...]]"
```

#### Code Sample, a copy-pastable example if possible

```python
>>> import pandas as pd
>>> pd.__version__
'0.25.0+332.g261c3a667'
>>>
>>> ser = pd.Series([1,2,3])
>>>
>>> ser
0    1
1    2
2    3
dtype: int64
>>>
>>> ser.append(ser)
0    1
1    2
2    3
0    1
1    2
2    3
dtype: int64
>>>
>>> ser.append([ser,ser])
0    1
1    2
2    3
0    1
1    2
2    3
0    1
1    2
2    3
dtype: int64
>>>
>>> ser.append((ser,ser))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\core\series.py", line 2733, in append
    to_concat = [self] + to_append
TypeError: can only concatenate list (not "tuple") to list

```
#### Problem description

The docstring for Series.append states `to_append : Series or list/tuple of Series`. Appending a tuple of Series raises `TypeError: can only concatenate list (not "tuple") to list`


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
@@ -2730,7 +2730,8 @@ def append(self, to_append, ignore_index=False, verify_integrity=False):
         from pandas.core.reshape.concat import concat
 
         if isinstance(to_append, (list, tuple)):
-            to_concat = [self] + to_append
+            to_concat = [self]
+            to_concat.extend(to_append)
         else:
             to_concat = [self, to_append]
         return concat(


Test patch:
diff --git a/pandas/tests/series/test_combine_concat.py b/pandas/tests/series/test_combine_concat.py
--- a/pandas/tests/series/test_combine_concat.py
+++ b/pandas/tests/series/test_combine_concat.py
@@ -54,6 +54,17 @@ def test_append_duplicates(self):
         with pytest.raises(ValueError, match=msg):
             pd.concat([s1, s2], verify_integrity=True)
 
+    def test_append_tuples(self):
+        # GH 28410
+        s = pd.Series([1, 2, 3])
+        list_input = [s, s]
+        tuple_input = (s, s)
+
+        expected = s.append(list_input)
+        result = s.append(tuple_input)
+
+        tm.assert_series_equal(expected, result)
+
     def test_combine_scalar(self):
         # GH 21248
         # Note - combine() with another Series is tested elsewhere because
Repository: pandas-dev/pandas

Issue:
DataFrame.to_html should validate that formatters has the correct length
The length of `formatters` should match the number of columns

Both of these should error with a nice message.

```python
In [2]: df = pd.DataFrame(columns=['a', 'b', 'c'])

In [3]: df.to_html(formatters=['{}'.format])


In [4]: df.to_html(formatters=['{}'.format] * 5)
```

Currntly `In [4]` succeeds, silently ignoring the bad input. `In[3]` values with a vague `IndexError: list index out of range`.


Discussion:
Hi! Can @hugoecarl and @gabriellm1 and I work on this?
@guipleite for sure - would certainly take a PR from you all
So in case `In[3]` and `In[4]` the result error should be the same as `formatters list not same length as Dataframe` ? If so, where in the project should this be made?
Possibly in `DataFrameFormatter.__init__`? Not really sure.

Resolving patch:
diff --git a/pandas/io/formats/format.py b/pandas/io/formats/format.py
--- a/pandas/io/formats/format.py
+++ b/pandas/io/formats/format.py
@@ -561,7 +561,17 @@ def __init__(
         self.sparsify = sparsify
 
         self.float_format = float_format
-        self.formatters = formatters if formatters is not None else {}
+        if formatters is None:
+            self.formatters = {}
+        elif len(frame.columns) == len(formatters) or isinstance(formatters, dict):
+            self.formatters = formatters
+        else:
+            raise ValueError(
+                (
+                    "Formatters length({flen}) should match"
+                    " DataFrame number of columns({dlen})"
+                ).format(flen=len(formatters), dlen=len(frame.columns))
+            )
         self.na_rep = na_rep
         self.decimal = decimal
         self.col_space = col_space


Test patch:
diff --git a/pandas/tests/io/formats/test_to_html.py b/pandas/tests/io/formats/test_to_html.py
--- a/pandas/tests/io/formats/test_to_html.py
+++ b/pandas/tests/io/formats/test_to_html.py
@@ -235,6 +235,15 @@ def test_to_html_truncate(datapath):
     assert result == expected
 
 
+@pytest.mark.parametrize("size", [1, 5])
+def test_html_invalid_formatters_arg_raises(size):
+    # issue-28469
+    df = DataFrame(columns=["a", "b", "c"])
+    msg = "Formatters length({}) should match DataFrame number of columns(3)"
+    with pytest.raises(ValueError, match=re.escape(msg.format(size))):
+        df.to_html(formatters=["{}".format] * size)
+
+
 def test_to_html_truncate_formatter(datapath):
     # issue-25955
     data = [