class_docstr: Unit tests for the counts.process_samples method
docstr: Test that the counts function disregards failed measurements (samples including
  NaN values) when totalling counts
docstr_tok: ["Test","that","the","counts","function","disregards","failed","measurements","(","samples","including","NaN","values",")","when","totalling","counts"]
code: def test_counts_with_nan_samples(self):
      """Test that the counts function disregards failed measurements (samples including
      NaN values) when totalling counts"""
      shots = 1000
      samples = np.random.choice([0, 1], size=(shots, 2)).astype(
          np.float64
      )
  
      samples[0][0] = np.NaN
      samples[17][1] = np.NaN
      samples[850][0] = np.NaN
  
      result = qml.counts(wires=[0, 1]).process_samples(
          samples, wire_order=[0, 1]
      )
  
      # no keys with NaNs
      assert len(result) == 4
      assert set(result.keys()) == {"00", "01", "10", "11"}
  
      # NaNs were not converted into "0", but were excluded from the counts
      total_counts = sum(count for count in result.values())
      assert total_counts == 997
  
imports: import copy
  import numpy
  import pytest
  import pennylane
  from pennylane.measurements import AllCounts, Counts, CountsMP
  from pennylane.wires import Wires
label_desc: Use image node_id 3 for calling the TestProcessSamples obj's underlying member method code with example usage: obj.test_counts_with_nan_samples() without return types