Repository: pandas-dev/pandas

Issue:
Status of the examples
@tvyomkesh opened some issues (#9384, #9389) on errors in the examples (and some PRs to fix this). This raised the following question to me:

Apart from fixing the examples, I think we should think for a moment what we want to do with these examples. Why do we want them? What is their function?
And depending on that, do we want to update/extend them? Or maybe move them to the docs?

I personally never looked at these examples. And they are also quite outdated. Eg using the ols from pandas is somewhat (unofficially) deprecated for the use of statsmodels, and the finance module in matplotlib is deprecated starting from matplotlib 1.4. And to get such data, I think pandas-datareader should be used.

@jreback @TomAugspurger @shoyer



Discussion:
repeat of my comment:

I think that these should be checked to see if they are in the docs ; if not and appropriate add any
then blow away the entire directory
these are just duplicate, not maintained, not tested and pretty much superfluous to the docs

Agreed -- they really should go away. I wouldn't even bother fixing them up.


Resolving patch:
diff --git a/examples/finance.py b/examples/finance.py
deleted file mode 100644
--- a/examples/finance.py
+++ /dev/null
@@ -1,86 +0,0 @@
-"""
-Some examples playing around with yahoo finance data
-"""
-
-from datetime import datetime
-from pandas.compat import zip
-
-import matplotlib.finance as fin
-import numpy as np
-from pylab import show
-
-
-from pandas import Index, DataFrame
-from pandas.core.datetools import BMonthEnd
-from pandas import ols
-
-startDate = datetime(2008, 1, 1)
-endDate = datetime(2009, 9, 1)
-
-
-def getQuotes(symbol, start, end):
-    quotes = fin.quotes_historical_yahoo(symbol, start, end)
-    dates, open, close, high, low, volume = zip(*quotes)
-
-    data = {
-        'open': open,
-        'close': close,
-        'high': high,
-        'low': low,
-        'volume': volume
-    }
-
-    dates = Index([datetime.fromordinal(int(d)) for d in dates])
-    return DataFrame(data, index=dates)
-
-msft = getQuotes('MSFT', startDate, endDate)
-aapl = getQuotes('AAPL', startDate, endDate)
-goog = getQuotes('GOOG', startDate, endDate)
-ibm = getQuotes('IBM', startDate, endDate)
-
-px = DataFrame({'MSFT': msft['close'],
-                'IBM': ibm['close'],
-                'GOOG': goog['close'],
-                'AAPL': aapl['close']})
-returns = px / px.shift(1) - 1
-
-# Select dates
-
-subIndex = ibm.index[(ibm['close'] > 95) & (ibm['close'] < 100)]
-msftOnSameDates = msft.reindex(subIndex)
-
-# Insert columns
-
-msft['hi-lo spread'] = msft['high'] - msft['low']
-ibm['hi-lo spread'] = ibm['high'] - ibm['low']
-
-# Aggregate monthly
-
-
-def toMonthly(frame, how):
-    offset = BMonthEnd()
-
-    return frame.groupby(offset.rollforward).aggregate(how)
-
-msftMonthly = toMonthly(msft, np.mean)
-ibmMonthly = toMonthly(ibm, np.mean)
-
-# Statistics
-
-stdev = DataFrame({
-    'MSFT': msft.std(),
-    'IBM': ibm.std()
-})
-
-# Arithmetic
-
-ratios = ibm / msft
-
-# Works with different indices
-
-ratio = ibm / ibmMonthly
-monthlyRatio = ratio.reindex(ibmMonthly.index)
-
-# Ratio relative to past month average
-
-filledRatio = ibm / ibmMonthly.reindex(ibm.index, method='pad')
diff --git a/examples/regressions.py b/examples/regressions.py
deleted file mode 100644
--- a/examples/regressions.py
+++ /dev/null
@@ -1,51 +0,0 @@
-from datetime import datetime
-import string
-
-import numpy as np
-
-from pandas.core.api import Series, DataFrame, DatetimeIndex
-from pandas.stats.api import ols
-
-N = 100
-
-start = datetime(2009, 9, 2)
-dateRange = DatetimeIndex(start, periods=N)
-
-
-def makeDataFrame():
-    data = DataFrame(np.random.randn(N, 7),
-                     columns=list(string.ascii_uppercase[:7]),
-                     index=dateRange)
-
-    return data
-
-
-def makeSeries():
-    return Series(np.random.randn(N), index=dateRange)
-
-#-------------------------------------------------------------------------------
-# Standard rolling linear regression
-
-X = makeDataFrame()
-Y = makeSeries()
-
-model = ols(y=Y, x=X)
-
-print(model)
-
-#-------------------------------------------------------------------------------
-# Panel regression
-
-data = {
-    'A': makeDataFrame(),
-    'B': makeDataFrame(),
-    'C': makeDataFrame()
-}
-
-Y = makeDataFrame()
-
-panelModel = ols(y=Y, x=data, window=50)
-
-model = ols(y=Y, x=data)
-
-print(panelModel)


Test patch: