'pyspark recover for an even number the two values of a median
Is there a way i pyspark to recover for an even number the two values of a median ?
For exemple: I have this dataframe
df1 = spark.createDataFrame([
('c',1),
('c',2),
('c',4),
('c',6),
('c',7),
('c',8),
], ['a', 'b'])
df1.show()
+---+---+
| a| b|
+---+---+
| c| 1|
| c| 2|
| c| 4|
| c| 6|
| c| 7|
| c| 8|
I want for this dataframe to display the values 4 and 6
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|