def median(spark_column: Column, spark_type: DataType) -> Column:
    if isinstance(spark_type, (BooleanType, NumericType)):
        return F.percentile_approx(spark_column.cast(DoubleType()), 0.5, accuracy)
    else:
        raise TypeError('Could not convert {} ({}) to numeric'.format(spark_type_to_pandas_dtype(spark_type), spark_type.simpleString()))
def median(spark_column: Column, spark_type: DataType) -> Column:
    if isinstance(spark_type, (BooleanType, NumericType)):
        return F.percentile_approx(spark_column.cast(DoubleType()), 0.5, accuracy)
    else:
        raise TypeError('Could not convert {} ({}) to numeric'.format(spark_type_to_pandas_dtype(spark_type), spark_type.simpleString()))