In [50]:
import pandas as pd
import numpy.random as npr
import scipy.cluster.hierarchy as hac

dfTest = pd.DataFrame({
        'groupvar': npr.randint(2, size = 1000),
        'ElecCons': npr.normal(size = 1000), 
        'SomeOtherVar': npr.normal(size = 1000)
    })

hac.fclusterdata(X = dfTest.as_matrix(['ElecCons']), 
                t = 3, 
                 criterion = 'maxclust', 
                 metric = 'euclidean',
                method = 'average')


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-50-04dfce45a2c5> in <module>()
     13                  criterion = 'maxclust',
     14                  metric = 'euclidean',
---> 15                 method = 'ward')

/usr/local/lib/python3.4/dist-packages/scipy/cluster/hierarchy.py in fclusterdata(X, t, criterion, metric, depth, method, R)
   1614 
   1615     Y = distance.pdist(X, metric=metric)
-> 1616     Z = linkage(Y, method=method)
   1617     if R is None:
   1618         R = inconsistent(Z, d=depth)

/usr/local/lib/python3.4/dist-packages/scipy/cluster/hierarchy.py in linkage(y, method, metric)
    625         d = distance.num_obs_y(y)
    626         if method not in _cpy_non_euclid_methods:
--> 627             raise ValueError("Valid methods when the raw observations are "
    628                              "omitted are 'single', 'complete', 'weighted', "
    629                              "and 'average'.")

ValueError: Valid methods when the raw observations are omitted are 'single', 'complete', 'weighted', and 'average'.