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

Issue:
TST: yahoo options tests additional skipping criteria
https://travis-ci.org/pydata/pandas/jobs/40415856
https://travis-ci.org/pydata/pandas/jobs/40425986
cc @dstephens99

These are hitting a `ValueError` on multiple-pr's I have seen. Maybe they are getting partial data?
So need to skip on that particular error (not exactly sure where that is coming from).



Discussion:

Resolving patch:
diff --git a/pandas/io/data.py b/pandas/io/data.py
--- a/pandas/io/data.py
+++ b/pandas/io/data.py
@@ -1132,10 +1132,13 @@ def _get_expiry_dates_and_links(self):
 
         expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
         links = [element.attrib['data-selectbox-link'] for element in links]
+
+        if len(expiry_dates) == 0:
+            raise RemoteDataError('Data not available')
+
         expiry_links = dict(zip(expiry_dates, links))
         self._expiry_links = expiry_links
         self._expiry_dates = expiry_dates
-
         return expiry_dates, expiry_links
 
     def _parse_url(self, url):


Test patch:
Repository: pandas-dev/pandas

Issue:
BUG:  fontsize parameter of plot only affects x-axis.
``` python
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(10, 9), index=range(10))
df.plot()
```

Results in this plot (all the same font size):
![figure_with_normal_font](https://cloud.githubusercontent.com/assets/5957850/4969656/a577b85c-6866-11e4-8f5a-9861650cb7ae.png)

``` python
df.plot(fontsize=4)
```

Results in this plot (only the x-axis font size is changed):
![figure_with_small_font](https://cloud.githubusercontent.com/assets/5957850/4969658/c1d949de-6866-11e4-91cb-4495242e45b9.png)



Discussion:

Resolving patch:
diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py
--- a/pandas/tools/plotting.py
+++ b/pandas/tools/plotting.py
@@ -2397,9 +2397,9 @@ def _plot(data, x=None, y=None, subplots=False,
     xlim : 2-tuple/list
     ylim : 2-tuple/list
     rot : int, default None
-        Rotation for ticks
+        Rotation for ticks (xticks for vertical, yticks for horizontal plots)
     fontsize : int, default None
-        Font size for ticks
+        Font size for xticks and yticks
     colormap : str or matplotlib colormap object, default None
         Colormap to select colors from. If string, load colormap with that name
         from matplotlib.


Test patch:
diff --git a/pandas/tests/test_graphics.py b/pandas/tests/test_graphics.py
--- a/pandas/tests/test_graphics.py
+++ b/pandas/tests/test_graphics.py
@@ -1230,7 +1230,7 @@ def test_subplots_timeseries(self):
                 self._check_visible(ax.get_xticklabels(minor=True))
                 self._check_visible(ax.xaxis.get_label())
                 self._check_visible(ax.get_yticklabels())
-                self._check_ticks_props(ax, xlabelsize=7, xrot=45)
+                self._check_ticks_props(ax, xlabelsize=7, xrot=45, ylabelsize=7)
 
     def test_subplots_layout(self):
         # GH 6667
@@ -1691,13 +1691,13 @@ def test_plot_bar(self):
         self._check_ticks_props(ax, xrot=90)
 
         ax = df.plot(kind='bar', rot=35, fontsize=10)
-        self._check_ticks_props(ax, xrot=35, xlabelsize=10)
+        self._check_ticks_props(ax, xrot=35, xlabelsize=10, ylabelsize=10)
 
         ax = _check_plot_works(df.plot, kind='barh')
         self._check_ticks_props(ax, yrot=0)
 
         ax = df.plot(kind='barh', rot=55, fontsize=11)
-        self._check_ticks_props(ax, yrot=55, ylabelsize=11)
+        self._check_ticks_props(ax, yrot=55, ylabelsize=11, xlabelsize=11)
 
     def _check_bar_alignment(self, df, kind='bar', stacked=False,
                              subplots=False, align='center',
@@ -2061,7 +2061,7 @@ def test_kde_df(self):
         self._check_ticks_props(ax, xrot=0)
 
         ax = df.plot(kind='kde', rot=20, fontsize=5)
-        self._check_ticks_props(ax, xrot=20, xlabelsize=5)
+        self._check_ticks_props(ax, xrot=20, xlabelsize=5, ylabelsize=5)
 
         axes = _check_plot_works(df.plot, kind='kde', subplots=True)
         self._check_axes_shape(axes, axes_num=4, layout=(4, 1))
Repository: pandas-dev/pandas

Issue:
VIS: plot with `use_index=False` shouldn't plot the index name
```
n [1]: df = pd.Series([1, 2, 3], index=['a', 'b', 'c'])

In [2]: df.index.name = 'The Index'

In [5]: df.plot(use_index=False)
Out[5]: <matplotlib.axes._subplots.AxesSubplot at 0x10b1a1438>
```

![gh](https://cloud.githubusercontent.com/assets/1312546/4639393/2e6af314-540c-11e4-9d07-6c5ab8250aae.png)

The x axis label



Discussion:

Resolving patch:
diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py
--- a/pandas/tools/plotting.py
+++ b/pandas/tools/plotting.py
@@ -1685,7 +1685,7 @@ def _post_plot_logic(self):
                     self.rot = 30
                 format_date_labels(ax, rot=self.rot)
 
-            if index_name is not None:
+            if index_name is not None and self.use_index:
                 ax.set_xlabel(index_name)
 
 
@@ -1874,7 +1874,7 @@ def _post_plot_logic(self):
                 ax.set_xticklabels(str_index)
                 if not self.log: # GH3254+
                     ax.axhline(0, color='k', linestyle='--')
-                if name is not None:
+                if name is not None and self.use_index:
                     ax.set_xlabel(name)
             elif self.kind == 'barh':
                 # horizontal bars
@@ -1882,7 +1882,7 @@ def _post_plot_logic(self):
                 ax.set_yticks(self.tick_pos)
                 ax.set_yticklabels(str_index)
                 ax.axvline(0, color='k', linestyle='--')
-                if name is not None:
+                if name is not None and self.use_index:
                     ax.set_ylabel(name)
             else:
                 raise NotImplementedError(self.kind)


Test patch:
diff --git a/pandas/tests/test_graphics.py b/pandas/tests/test_graphics.py
--- a/pandas/tests/test_graphics.py
+++ b/pandas/tests/test_graphics.py
@@ -569,6 +569,16 @@ def test_line_area_nan_series(self):
             ax = _check_plot_works(d.plot, kind='area', stacked=False)
             self.assert_numpy_array_equal(ax.lines[0].get_ydata(), expected)
 
+    def test_line_use_index_false(self):
+        s = Series([1, 2, 3], index=['a', 'b', 'c'])
+        s.index.name = 'The Index'
+        ax = s.plot(use_index=False)
+        label = ax.get_xlabel()
+        self.assertEqual(label, '')
+        ax2 = s.plot(kind='bar', use_index=False)
+        label2 = ax2.get_xlabel()
+        self.assertEqual(label2, '')
+
     @slow
     def test_bar_log(self):
         expected = np.array([1., 10., 100., 1000.])
Repository: pandas-dev/pandas

Issue:
splitting pandas dataframe - np.array_split error
I just noticed that after upgrading to numpy 1.9.0, when I'm trying to split dataframe with pandas 0.15.1 with the code:

```
split_dfs = np.array_split(big_df,8)    
```

I get the error:

```
Traceback (most recent call last):
  File "./test.py", line 127, in <module>
    split_dfs = np.array_split(big_df,8)
  File "/usr/lib/python2.7/site-packages/numpy/lib/shape_base.py", line 426, in array_split
    if sub_arys[-1].size == 0 and sub_arys[-1].ndim != 1:
  File "/usr/lib/python2.7/site-packages/pandas-0.15.1-py2.7-linux-x86_64.egg/pandas   /core/generic.py", line 1936, in __getattr__
(type(self).__name__, name))
AttributeError: 'DataFrame' object has no attribute 'size'
```

with pandas 0.15.1 and numpy 1.8.1 it works fine.
I'm using pandas 0.15.1 on arch linux and python2.7



Discussion:
This is due to a change in numpy: https://github.com/numpy/numpy/pull/4102 (`.size` is used to check if a FutureWarning should be raised or not, introduced in numpy 1.9.0).

But, this is a numpy function, and not really guaranteed to work with pandas dataframes although it did before (or should numpy do an `asarray`? @jreback , or should DataFrame have a `size` attribute?)

For a pandas-native split functionality, see the enhancement request: #7387


Resolving patch:
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -381,6 +381,11 @@ def ndim(self):
         "Number of axes / array dimensions"
         return self._data.ndim
 
+    @property
+    def size(self):
+        "number of elements in the NDFrame"
+        return np.prod(self.shape)
+
     def _expand_axes(self, key):
         new_axes = []
         for k, ax in zip(key, self.axes):


Test patch:
diff --git a/pandas/tests/test_generic.py b/pandas/tests/test_generic.py
--- a/pandas/tests/test_generic.py
+++ b/pandas/tests/test_generic.py
@@ -352,6 +352,21 @@ def test_head_tail(self):
             self._compare(o.head(-3), o.head(7))
             self._compare(o.tail(-3), o.tail(7))
 
+
+    def test_size_compat(self):
+        # GH8846
+        # size property should be defined
+
+        o = self._construct(shape=10)
+        self.assertTrue(o.size == np.prod(o.shape))
+        self.assertTrue(o.size == 10**len(o.axes))
+
+    def test_split_compat(self):
+        # xref GH8846
+        o = self._construct(shape=10)
+        self.assertTrue(len(np.array_split(o,5)) == 5)
+        self.assertTrue(len(np.array_split(o,2)) == 2)
+
 class TestSeries(tm.TestCase, Generic):
     _typ = Series
     _comparator = lambda self, x, y: assert_series_equal(x,y)
@@ -1422,8 +1437,8 @@ def test_equals(self):
         self.assertTrue(a.equals(c))
         self.assertTrue(a.equals(d))
         self.assertFalse(a.equals(e))
-        self.assertTrue(e.equals(f)) 
-        
+        self.assertTrue(e.equals(f))
+
     def test_describe_raises(self):
         with tm.assertRaises(NotImplementedError):
             tm.makePanel().describe()
Repository: pandas-dev/pandas

Issue:
pd.option_context without 'with' changes option values
Just wondering if this is a bug, from http://stackoverflow.com/questions/26246864/restoring-the-default-display-context-in-pandas

If you use `pd.option_context` accidentally without `with`, this changes the default option values.



Discussion:
BTW, using `reset_options` generates deprecation warnings:

```
In [22]: pd.reset_option('all')
height has been deprecated.

line_width has been deprecated, use display.width instead (currently both are identical)
```

These should be suppressed here I think.

Should the option setting (https://github.com/pydata/pandas/blob/master/pandas/core/config.py#L394) happen in the `__enter__` instead of `__init__`?

yep it _looks_ like it should be happening in `__enter__`, then I suppose you could do:

```
i = pd.option_context(.......)
j = pd.option_context(.....different ones...)

with i:
    do something

with j:
    do something else

```


Resolving patch:
diff --git a/pandas/core/config.py b/pandas/core/config.py
--- a/pandas/core/config.py
+++ b/pandas/core/config.py
@@ -384,19 +384,18 @@ def __init__(self, *args):
                 'option_context(pat, val, [(pat, val), ...)).'
             )
 
-        ops = list(zip(args[::2], args[1::2]))
+        self.ops = list(zip(args[::2], args[1::2]))
+
+    def __enter__(self):
         undo = []
-        for pat, val in ops:
+        for pat, val in self.ops:
             undo.append((pat, _get_option(pat, silent=True)))
 
         self.undo = undo
 
-        for pat, val in ops:
+        for pat, val in self.ops:
             _set_option(pat, val, silent=True)
 
-    def __enter__(self):
-        pass
-
     def __exit__(self, *args):
         if self.undo:
             for pat, val in self.undo:


Test patch:
diff --git a/pandas/tests/test_config.py b/pandas/tests/test_config.py
--- a/pandas/tests/test_config.py
+++ b/pandas/tests/test_config.py
@@ -425,3 +425,24 @@ def f3(key):
         options.c = 1
         self.assertEqual(len(holder), 1)
 
+    def test_option_context_scope(self):
+        # Ensure that creating a context does not affect the existing
+        # environment as it is supposed to be used with the `with` statement.
+        # See https://github.com/pydata/pandas/issues/8514
+
+        original_value = 60
+        context_value = 10
+        option_name = 'a'
+
+        self.cf.register_option(option_name, original_value)
+
+        # Ensure creating contexts didn't affect the current context.
+        ctx = self.cf.option_context(option_name, context_value)
+        self.assertEqual(self.cf.get_option(option_name), original_value)
+
+        # Ensure the correct value is available inside the context.
+        with ctx:
+            self.assertEqual(self.cf.get_option(option_name), context_value)
+
+        # Ensure the current context is reset
+        self.assertEqual(self.cf.get_option(option_name), original_value)
Repository: pandas-dev/pandas

Issue:
isnull not detecting NaT in PeriodIndex
```
In [158]: x = pd.to_datetime([np.nan, '2000-1-1'])

In [159]: y = x.to_period(freq='m')

In [160]: y
Out[160]: 
<class 'pandas.tseries.period.PeriodIndex'>
[NaT, 2000-01]
Length: 2, Freq: M

In [161]: pd.isnull(x)
Out[161]: array([ True, False], dtype=bool)

In [162]: pd.isnull(y)
Out[162]: array([False, False], dtype=bool)
```

I think `pd.isnull(y)` should be returning `array([True, False], dtype=bool)`.



Discussion:
hmm, must be taking an odd path

https://github.com/pydata/pandas/blob/master/pandas/core/common.py#L305 (this is done in several places)

maybe make a function

```
is_datetimelike(arr):
     return arr.dtype in _DATETIME_TYPE or isintance(arr, ABCPeriodIndex)
```


Resolving patch:
diff --git a/pandas/core/base.py b/pandas/core/base.py
--- a/pandas/core/base.py
+++ b/pandas/core/base.py
@@ -441,7 +441,12 @@ def nunique(self, dropna=True):
         -------
         nunique : int
         """
-        return len(self.value_counts(dropna=dropna))
+        uniqs = self.unique()
+        n = len(uniqs)
+        if dropna and com.isnull(uniqs).any():
+            n -= 1
+        return n
+
 
     def factorize(self, sort=False, na_sentinel=-1):
         """
diff --git a/pandas/core/common.py b/pandas/core/common.py
--- a/pandas/core/common.py
+++ b/pandas/core/common.py
@@ -302,7 +302,7 @@ def _isnull_ndarraylike(obj):
                 vec = lib.isnullobj(values.ravel())
                 result[...] = vec.reshape(shape)
 
-    elif dtype in _DATELIKE_DTYPES:
+    elif is_datetimelike(obj):
         # this is the NaT pattern
         result = values.view('i8') == tslib.iNaT
     else:
@@ -2366,6 +2366,9 @@ def is_datetime_arraylike(arr):
         return arr.dtype == object and lib.infer_dtype(arr) == 'datetime'
     return getattr(arr, 'inferred_type', None) == 'datetime'
 
+def is_datetimelike(arr):
+    return arr.dtype in _DATELIKE_DTYPES or isinstance(arr, ABCPeriodIndex)
+
 def _coerce_to_dtype(dtype):
     """ coerce a string / np.dtype to a dtype """
     if is_categorical_dtype(dtype):


Test patch:
diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py
--- a/pandas/tests/test_common.py
+++ b/pandas/tests/test_common.py
@@ -157,6 +157,15 @@ def test_isnull_datetime():
     assert(mask[0])
     assert(not mask[1:].any())
 
+    # GH 9129
+    pidx = idx.to_period(freq='M')
+    mask = isnull(pidx)
+    assert(mask[0])
+    assert(not mask[1:].any())
+
+    mask = isnull(pidx[1:])
+    assert(not mask.any())
+
 
 class TestIsNull(tm.TestCase):
     def test_0d_array(self):
Repository: pandas-dev/pandas

Issue:
Referencing a panel with an object causes an inf loop in 0.15.2
The snippet of code works fine in 0.15.0.  Not sure about 0.15.1 as I did not try it on that version.  However on 0.15.2 it causes an infinite loop

```
import pandas
import numpy

class TestObject:
        def __str__(self):
                return "TestObject"

obj = TestObject()

wp = pandas.Panel(numpy.random.randn(1,5,4), items=[obj],
        major_axis = pandas.date_range('1/1/2000', periods=5),
        minor_axis=['A', 'B', 'C', 'D'])


print(wp)

print(wp[obj])
```



Discussion:

Resolving patch:
diff --git a/pandas/core/panel.py b/pandas/core/panel.py
--- a/pandas/core/panel.py
+++ b/pandas/core/panel.py
@@ -253,7 +253,7 @@ def from_dict(cls, data, intersect=False, orient='items', dtype=None):
     def __getitem__(self, key):
         if isinstance(self._info_axis, MultiIndex):
             return self._getitem_multilevel(key)
-        if lib.isscalar(key):
+        if not (_is_list_like(key) or isinstance(key, slice)):
             return super(Panel, self).__getitem__(key)
         return self.ix[key]
 


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
@@ -2448,6 +2448,22 @@ def test_panel_getitem(self):
         result = panel.ix[['ItemA','ItemB']]
         tm.assert_panel_equal(result,expected)
 
+        # with an object-like
+        # GH 9140
+        class TestObject:
+            def __str__(self):
+                return "TestObject"
+
+        obj = TestObject()
+
+        p = Panel(np.random.randn(1,5,4), items=[obj],
+                  major_axis = date_range('1/1/2000', periods=5),
+                  minor_axis=['A', 'B', 'C', 'D'])
+
+        expected = p.iloc[0]
+        result = p[obj]
+        tm.assert_frame_equal(result, expected)
+
     def test_panel_setitem(self):
 
         # GH 7763
Repository: pandas-dev/pandas

Issue:
API: .dt.components attribute on timedelta series does not preserve the index
```
In [70]: tds = pd.Series(pd.timedelta_range('1 days', periods=5, freq='2 h'), index=list('ABCDE'))

In [71]: tds
Out[71]:
A   1 days 00:00:00
B   1 days 02:00:00
C   1 days 04:00:00
D   1 days 06:00:00
E   1 days 08:00:00
dtype: timedelta64[ns]

In [72]: tds.dt.hours
Out[72]:
A    0
B    2
C    4
D    6
E    8
dtype: int64

In [73]: tds.dt.components.hours
Out[73]:
0    0
1    2
2    4
3    6
4    8
Name: hours, dtype: int64
```

So the direct attributes via `.dt` like `.dt.hours` above does preserve the index, but the `components` not. 

@jreback I don't know if this was done on purpose or is an oversight, I can't remember, and I looked briefly to the long discussion in #8184, but didn't find something directly.



Discussion:
this is a bug - it should be the same index


Resolving patch:
diff --git a/pandas/tseries/common.py b/pandas/tseries/common.py
--- a/pandas/tseries/common.py
+++ b/pandas/tseries/common.py
@@ -139,7 +139,7 @@ def to_pytimedelta(self):
 
     @property
     def components(self):
-        return self.values.components
+        return self.values.components.set_index(self.index)
 
 TimedeltaProperties._add_delegate_accessors(delegate=TimedeltaIndex,
                                             accessors=TimedeltaIndex._datetimelike_ops,


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
@@ -142,7 +142,7 @@ def compare(s, name):
             tm.assert_series_equal(result, expected)
 
         # timedeltaindex
-        for s in [Series(timedelta_range('1 day',periods=5)),
+        for s in [Series(timedelta_range('1 day',periods=5),index=list('abcde')),
                   Series(timedelta_range('1 day 01:23:45',periods=5,freq='s')),
                   Series(timedelta_range('2 days 01:23:45.012345',periods=5,freq='ms'))]:
             for prop in ok_for_td:
Repository: pandas-dev/pandas

Issue:
Improve error message in plotting.py's _plot
This a minor enhancement proposal. At the moment I cannot submit a pull request. I will probably have time to create one during the next week. 

This is a snippet from `tools/plotting.py`: https://github.com/pydata/pandas/blob/master/pandas/tools/plotting.py#L2269-2283

``` python
def _plot(data, x=None, y=None, subplots=False,
          ax=None, kind='line', **kwds):
    kind = _get_standard_kind(kind.lower().strip())
    if kind in _all_kinds:
        klass = _plot_klass[kind]
    else:
        raise ValueError('Invalid chart type given %s' % kind)

    from pandas import DataFrame
    if kind in _dataframe_kinds:
        if isinstance(data, DataFrame):
            plot_obj = klass(data, x=x, y=y, subplots=subplots, ax=ax,
                             kind=kind, **kwds)
        else:
            raise ValueError('Invalid chart type given %s' % kind)
```

Which results in following error message:

```
C:\Anaconda3\lib\site-packages\pandas\tools\plotting.py in plot_series(series, label, kind, use_index, rot, xticks, yticks, xlim, ylim, ax, style, grid, legend, logx, logy, secondary_y, **kwds)
   2231         klass = _plot_klass[kind]
   2232     else:
-> 2233         raise ValueError('Invalid chart type given %s' % kind)
   2234 
   2235     """

ValueError: Invalid chart type given hist
```

I would suggest using the format string `"Invalid chart type given: '%s'"` instead.



Discussion:
I think that is certainly a good proposal. Do a PR when you like!


Resolving patch:
diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py
--- a/pandas/tools/plotting.py
+++ b/pandas/tools/plotting.py
@@ -2266,7 +2266,7 @@ def _plot(data, x=None, y=None, subplots=False,
     if kind in _all_kinds:
         klass = _plot_klass[kind]
     else:
-        raise ValueError('Invalid chart type given %s' % kind)
+        raise ValueError("%r is not a valid plot kind" % kind)
 
     from pandas import DataFrame
     if kind in _dataframe_kinds:
@@ -2274,7 +2274,8 @@ def _plot(data, x=None, y=None, subplots=False,
             plot_obj = klass(data, x=x, y=y, subplots=subplots, ax=ax,
                              kind=kind, **kwds)
         else:
-            raise ValueError('Invalid chart type given %s' % kind)
+            raise ValueError("plot kind %r can only be used for data frames"
+                             % kind)
 
     elif kind in _series_kinds:
         if isinstance(data, DataFrame):


Test patch:
Repository: pandas-dev/pandas

Issue:
'infer_freq' can return timerule (WOM-5MON) that 'to_offset' does not support
``` python
import pandas as pd
index = [pd.Timestamp('2014-03-31 00:00:00'),
         pd.Timestamp('2014-06-30 00:00:00'),
         pd.Timestamp('2015-03-30 00:00:00'),
         pd.Timestamp('2015-06-29 00:00:00')]
freq = pd.infer_freq(index)  # WOM-5MON
pd.datetools.to_offset(freq)  # ValueError: Could not evaluate WOM-5MON
```

Instead of supporting WOM-5###, I think we can easily modify _get_wom_rule() to return None for this set of dates so it doesn't get inferred.  Agree?



Discussion:

Resolving patch:
diff --git a/pandas/tseries/frequencies.py b/pandas/tseries/frequencies.py
--- a/pandas/tseries/frequencies.py
+++ b/pandas/tseries/frequencies.py
@@ -935,7 +935,9 @@ def _get_wom_rule(self):
             return None
 
         week_of_months = unique((self.index.day - 1) // 7)
-        if len(week_of_months) > 1:
+        # Only attempt to infer up to WOM-4. See #9425
+        week_of_months = week_of_months[week_of_months < 4]
+        if len(week_of_months) == 0 or len(week_of_months) > 1:
             return None
 
         # get which week


Test patch:
diff --git a/pandas/tseries/tests/test_frequencies.py b/pandas/tseries/tests/test_frequencies.py
--- a/pandas/tseries/tests/test_frequencies.py
+++ b/pandas/tseries/tests/test_frequencies.py
@@ -212,6 +212,16 @@ def test_week_of_month(self):
             for i in range(1, 5):
                 self._check_generated_range('1/1/2000', 'WOM-%d%s' % (i, day))
 
+    def test_fifth_week_of_month(self):
+        # Only supports freq up to WOM-4. See #9425
+        func = lambda: date_range('2014-01-01', freq='WOM-5MON')
+        self.assertRaises(ValueError, func)
+
+    def test_fifth_week_of_month_infer(self):
+        # Only attempts to infer up to WOM-4. See #9425
+        index = DatetimeIndex(["2014-03-31", "2014-06-30", "2015-03-30"])
+        assert frequencies.infer_freq(index) is None
+
     def test_week_of_month_fake(self):
         #All of these dates are on same day of week and are 4 or 5 weeks apart
         index = DatetimeIndex(["2013-08-27","2013-10-01","2013-10-29","2013-11-26"])