code: def test_covariance_update_sampled():
      # NOTE: this test only works with ddof=1 because pandas ignores it if there are missing values
      ddof = 1
      cov = covariance.EmpiricalCovariance(ddof=ddof)
  
      X = np.random.random((100, 5))
      samples = []
  
      for x, _ in stream.iter_array(X):
          sample = {
              i: x[i]
              for i in random.sample(list(x.keys()), k=len(x) - 1)
          }
          cov.update(sample)
          samples.append(sample)
  
      pd_cov = pd.DataFrame(samples).cov(ddof=ddof)
  
      for i, j in cov._cov:
          assert math.isclose(cov[i, j].get(), pd_cov.loc[i, j])
  
file_path: river/river/covariance/test_emp.py
imports: from __future__ import annotations
  import math
  import random
  import numpy
  import pandas
  import pytest
  from river import covariance, stream
label_desc: Use image node_id 3 for calling a global function with example usage: test_covariance_update_sampled() without return types