for
averageCount = (wordCountsDF
.groupBy().mean()).head()
I get
Row(avg(count)=1.6666666666666667)
but when I try:
averageCount = (wordCountsDF
.groupBy().mean()).head().getFloat(0)
I get the following error:
AttributeError: getFloat
--------------------------------------------------------------------------- AttributeError Traceback (most recent call
last) in ()
1 # TODO: Replace with appropriate code
----> 2 averageCount = (wordCountsDF
3 .groupBy().mean()).head().getFloat(0)
4
5 print averageCount
/databricks/spark/python/pyspark/sql/types.py in getattr(self,
item) 1270 raise AttributeError(item) 1271
except ValueError:
-> 1272 raise AttributeError(item) 1273 1274 def setattr(self, key, value):
AttributeError: getFloat
What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…