code: def test_count_cross_type():
      # GH8169
      # Set float64 dtype to avoid upcast when setting nan below
      vals = np.hstack(
          (
              np.random.default_rng(2).integers(0, 5, (100, 2)),
              np.random.default_rng(2).integers(0, 2, (100, 2)),
          )
      ).astype("float64")
  
      df = DataFrame(vals, columns=["a", "b", "c", "d"])
      df[df == 2] = np.nan
      expected = df.groupby(["c", "d"]).count()
  
      for t in ["float32", "object"]:
          df["a"] = df["a"].astype(t)
          df["b"] = df["b"].astype(t)
          result = df.groupby(["c", "d"]).count()
          tm.assert_frame_equal(result, expected)
  
imports: from itertools import product
  from string import ascii_lowercase
  import numpy
  import pytest
  from pandas import DataFrame, Index, MultiIndex, Period, Series, Timedelta, Timestamp, date_range
  import pandas._testing
label_desc: Use image node_id 5 for calling a global function with example usage: test_count_cross_type() without return types