code: def test_spark_ndcg_at_k(spark_data):
      df_true, df_pred = spark_data
  
      evaluator = SparkRankingEvaluation(
          df_true, df_true, k=10, col_prediction="rating"
      )
      assert evaluator.ndcg_at_k() == 1.0
  
      evaluator = SparkRankingEvaluation(df_true, df_pred, k=10)
      assert evaluator.ndcg_at_k() == pytest.approx(0.38172, TOL)
  
      evaluator = SparkRankingEvaluation(
          df_true,
          df_pred,
          relevancy_method="by_threshold",
          threshold=3.5,
      )
      assert evaluator.ndcg_at_k() == pytest.approx(0.38172, TOL)
  
imports: import pytest
  import numpy
  import pandas
  from pandas.util.testing import assert_frame_equal
  from recommenders.evaluation.python_evaluation import precision_at_k, recall_at_k, ndcg_at_k, map_at_k, map
label_desc: Use image node_id 11 for calling a global function with example usage: test_spark_ndcg_at_k(spark_data) without return types