code: def __validate_sketch_result(self, sketch, sa, delta=1e-7):
      df = pd.DataFrame(list(sa.dropna()))
      pds = pd.Series(list(sa.dropna()))
      if sa.dtype == int or sa.dtype == float:
          if len(sa) == 0:
              self.assertTrue(math.isnan(sketch.min()))
              self.assertTrue(math.isnan(sketch.min()))
              self.assertEqual(sketch.sum(), 0.0)
              self.assertEqual(sketch.mean(), 0.0)
              self.assertEqual(sketch.var(), 0.0)
              self.assertEqual(sketch.std(), 0.0)
          else:
              self.assertEqual(sketch.min(), sa.min())
              self.assertEqual(sketch.max(), sa.max())
              self.assertEqual(sketch.sum(), sa.sum())
              self.assertAlmostEqual(
                  sketch.mean(), sa.dropna().mean(), delta=delta
              )
              self.assertAlmostEqual(
                  sketch.var(), sa.dropna().var(), delta=delta
              )
              self.assertAlmostEqual(
                  sketch.std(), sa.dropna().std(), delta=delta
              )
              self.assertAlmostEqual(
                  sketch.quantile(0.5), df.quantile(0.5)[0], delta=1
              )
              self.assertEqual(sketch.quantile(0), df.quantile(0)[0])
              self.assertEqual(sketch.quantile(1), df.quantile(1)[0])
  
              self.assertEqual(
                  sketch.frequent_items(),
                  SArray(pds).summary().frequent_items(),
              )
              for item in pds.value_counts().index:
                  self.assertEqual(
                      sketch.frequency_count(item),
                      pds.value_counts()[item],
                  )
  
              self.assertAlmostEqual(
                  sketch.num_unique(), len(sa.unique()), delta=3
              )
      else:
          with self.assertRaises(RuntimeError):
              sketch.quantile((0.5))
  
      self.assertEqual(sketch.num_missing(), sa.countna())
      self.assertEqual(sketch.size(), len(sa))
      self.assertEqual(sketch.sketch_ready(), True)
      self.assertEqual(sketch.num_elements_processed(), sketch.size())
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from ..data_structures.sarray import SArray
  import pandas
  import numpy
  import unittest
  import random
  import copy
  import os
  import math
  import array
  import time
  import itertools
  import pytest
label_desc: Use image node_id 1 for calling the SArraySketchTest obj's underlying member method code with example usage: obj.__validate_sketch_result(sketch, sa, delta) without return types