2
以下代碼在我以前工作過,但現在不再了。我得到的錯誤:pyspark AttributeError:'DataFrame'對象沒有屬性'toDF'
AttributeError: 'DataFrame' object has no attribute 'toDF'
if __name__ == "__main__":
sc = SparkContext(appName="test")
sqlContext = SQLContext(sc)
df = sqlContext.read.format('com.databricks.spark.csv').\
options(header='false',delimiter=',',inferSchema='true').load('test')
### rename columns
df = df.toDF('a','b','c')
...
sc.stop()
你想完成什麼? – David
將列名分配給數據幀 – user3610141
[如何更改pyspark中的dataframe列名稱?](http://stackoverflow.com/questions/34077353/how-to-change-dataframe-column-names-in -pyspark) – David