code: def test_detect_string_floats():
      # test if we can find floats that are encoded as strings
      # sometimes they have weird missing values
      rng = np.random.RandomState(0)
      cont_clean = ["{:2.2f}".format(x) for x in rng.uniform(size=100)]
      dirty = pd.Series(cont_clean)
      # not strings, but actually numbers!
      dirty2 = pd.Series(rng.uniform(size=100))
      # FIXME this wouldn't work with using straight floats
      dirty3 = pd.Series(cont_clean)
      too_dirty = pd.Series(rng.uniform(size=100))
  
      # FIXME hardcoded frequency of tolerated missing
      # FIXME add test with integers
      # FIXME whitespace?
      dirty[::12] = "missing"
      dirty2[::12] = "missing"
      dirty3[::20] = [("missing", "but weird")] * 5
      too_dirty[::2] = rng.choice(list(string.ascii_letters), size=50)
      # only dirty:
      res = detect_types(pd.DataFrame(dirty))
      assert len(res) == 1
      assert res.dirty_float[0]
  
      # dirty and clean and weird stuff
      X = pd.DataFrame(
          {
              "cont": cont_clean,
              "dirty": dirty,
              "dirty2": dirty2,
              "dirty3": dirty3,
              "too_dirty": too_dirty,
          }
      )
      res = detect_types(X)
      assert len(res) == 5
      assert res.continuous["cont"]
      assert ~res.continuous["dirty"]
      assert ~res.continuous["dirty2"]
      assert ~res.continuous["dirty3"]
      assert ~res.dirty_float["cont"]
      assert res.dirty_float["dirty"]
      assert res.dirty_float["dirty2"]
      assert res.dirty_float["dirty3"]
      assert ~res.dirty_float["too_dirty"]
      assert ~res.free_string["dirty3"]
      assert res.free_string["too_dirty"]
  
      assert _float_matching(X.cont).all()
      is_float = X.dirty != "missing"
      assert (_float_matching(X.dirty) == is_float).all()
      assert (_float_matching(X.dirty2) == is_float).all()
      assert (
          _float_matching(X.dirty3) == (X.dirty3.map(type) == str)
      ).all()
      res = clean(X)
  
imports: import os
  import pytest
  import random
  import string
  import warnings
  import numpy
  import pandas
  from sklearn.datasets import load_iris, load_digits
  from sklearn.model_selection import train_test_split
  from sklearn.pipeline import make_pipeline
  from sklearn.linear_model import LogisticRegression
  from dabl.preprocessing import USELESS_TYPES, detect_types, EasyPreprocessor, DirtyFloatCleaner, clean, _FLOAT_REGEX, _float_matching, detect_type_series
  from dabl.utils import data_df_from_bunch
  from dabl.datasets import load_titanic
  from dabl import plot
label_desc: Use image node_id 13 for calling a global function with example usage: test_detect_string_floats() without return types