xarray.Dataset.to_dataframe
xarray.pydata.org › xarrayxarray.Dataset.to_dataframe¶ Dataset. to_dataframe (dim_order = None) [source] ¶ Convert this dataset into a pandas.DataFrame. Non-index variables in this dataset form the columns of the DataFrame. The DataFrame is indexed by the Cartesian product of this dataset’s indices. Parameters. dim_order – Hierarchical dimension order for the resulting dataframe. All arrays are transposed to this order and then written out as flat vectors in contiguous order, so the last dimension in this list ...
scala - Spark SQL convert dataset to dataframe - Stack Overflow
stackoverflow.com › questions › 52762979Oct 11, 2018 · In dataset, I have added some additional attribute ( newColumn) and convert it back to a dataframe. Here is my example code: ..... import sparkSession.implicits._ val res = empData.as [Emp] //for (i <- res.take (4)) println (i.name + " ->" + i.newColumn) val s = res.toDF (); s.printSchema () } case class Emp (name: String, gender: String, company: String, address: String) { val newColumn = if (gender == "male") "Not-allowed" else "Allowed" }