ENH: Allow fetching stock dividend and split info  from yahoo
State: closed

Usage:

``` python
from pandas.io.data import DataReader
```

Requesting dividends and splits but only dividends available

``` python
DataReader('CAT', 'yahoo', '12/31/04', '1/18/05', dividends=True, splits=True)

              Dividends
Date                   
2005-01-18.0      0.205
```

Requesting dividends and splits but only splits available

``` python
DataReader('CAT', 'yahoo', '7/14/05', '7/15/05', dividends=True, splits=True)

           Splits
Date             
2005-07-14    2:1
```

Requesting dividends and splits and both are available

``` python
DataReader('CAT', 'yahoo', '7/1/05', '8/1/05', dividends=True, splits=True)

            Dividends Splits
Date                       
2005-07-14       NaN    2:1
2005-07-20  0.250000    NaN
```

Requesting multiple dividends and splits

``` python
DataReader('CAT', 'yahoo', '7/14/97', '7/15/05', dividends=True, splits=True)

           Dividends Splits
Date                       
1997-07-14       NaN   2:1
1997-07-17  0.125000   NaN
1997-10-16  0.125000   NaN
1998-01-15  0.125000   NaN
1998-04-16  0.125000   NaN
1998-07-16  0.150000   NaN
1998-10-22  0.150000   NaN
1999-01-15  0.150000   NaN
1999-04-22  0.150000   NaN
1999-07-16  0.162500   NaN
1999-10-21  0.162500   NaN
2000-01-18  0.162500   NaN
2000-04-19  0.162500   NaN
2000-07-18  0.170000   NaN
2000-10-18  0.170000   NaN
2001-01-18  0.170000   NaN
2001-04-19  0.170000   NaN
2001-07-18  0.175000   NaN
2001-10-18  0.175000   NaN
2002-01-17  0.175000   NaN
2002-04-18  0.175000   NaN
2002-07-18  0.175000   NaN
2002-10-17  0.175000   NaN
2003-01-16  0.175000   NaN
2003-04-16  0.175000   NaN
2003-07-17  0.175000   NaN
2003-10-16  0.185000   NaN
2004-01-15  0.185000   NaN
2004-04-22  0.185000   NaN
2004-07-16  0.205000   NaN
2004-10-21  0.205000   NaN
2005-01-18  0.205000   NaN
2005-04-21  0.205000   NaN
2005-07-14       NaN   2:1
```

Requesting dividends or splits and neither are available

``` python
DataReader('CAT', 'yahoo', '7/21/05', '7/22/05', dividends=True)
DataReader('CAT', 'yahoo', '7/21/05', '7/22/05', splits=True)
Empty DataFrame
```

Requesting dividends and only dividends are available

``` python
DataReader('CAT', 'yahoo', '12/31/04', '1/18/05', dividends=True)
            Dividends
2005-01-18      0.205

```

Requesting dividends and both dividends and splits are available

``` python
DataReader('CAT', 'yahoo', '7/1/05', '8/01/05', dividends=True)

             Dividends
2005-07-20       0.25
```

Requesting dividends and only splits are available

``` python
DataReader('CAT', 'yahoo', '7/14/05', '7/15/05', dividends=True)
Empty DataFrame
```

Requesting multiple dividends

``` python
DataReader('CAT', 'yahoo', '7/20/05', '9/21/06', dividends=True)

            Dividends
2005-07-20       0.25
2005-10-20       0.25
2006-01-18       0.25
2006-04-20       0.25
2006-07-18       0.30
```

Requesting splits and only splits are available

``` python
DataReader('CAT', 'yahoo', '7/14/05', '7/15/05', splits=True)

           Splits
Date             
2005-07-14    2:1
```

Requesting splits and both dividends and splits are available

``` python
DataReader('CAT', 'yahoo', '7/1/05', '8/01/05', splits=True)

           Splits
Date             
2005-07-14    2:1
```

Requesting splits and only dividends are available

``` python
DataReader('CAT', 'yahoo', '12/31/04', '1/18/05', splits=True)
Empty DataFrame
```

Requesting multiple splits

``` python
DataReader('CAT', 'yahoo', '7/14/70', '7/15/05', splits=True)

           Splits
Date             
1994-09-06    2:1
1997-07-14    2:1
2005-07-14    2:1
```


Labels:

Comments:
can you add a mention in release notes?

also...can you add a test for this? (test_yahoo)...mark as network...thanks

@reubano need a test for this (e.g. retrive a known div/split for a ticker or 2 and compare that you get them)

mark tests as `@network`

also probably want to squash everything and keep the ENH: allow fetching ... 

@reubano I think if you want to get this in you'll need to refactor some of your code in light of the many changes in `data.py`...

BTW, it looks like yahoo dividends returned by DataReader are missing the last one. I am tweaking 0.12 install so it might be my problem but can you check what is latest div of CAT returned in unit test and compare it with http://finance.yahoo.com/q/hp?s=CAT&a=00&b=2&c=1962&d=07&e=21&f=2013&g=v

I think the problem is in this place in data.py around line 186:

```
       # Yahoo! Finance sometimes does this awesome thing where they                                                                               
        # return 2 rows for the most recent business day                                                                                            
        if len(rs) > 2 and rs.index[-1] == rs.index[-2]:  # pragma: no cover                                                                        
            rs = rs[:-1]
```

andrei

@reubano how's this coming along?

Stalled, closing.