code: def test_from_string():
      df = conversion_data()
      df.loc[:, "hex_int"] = df["int"].apply(hex)
      df.loc[:, "hex_float"] = df["float"].apply(float.hex)
      data_id, column_type = "1", "type_conversion"
      i = 0
      build_data_inst({data_id: df})
  
      cfg = {"col": "str_num", "to": "int", "from": "str"}
      builder = ColumnBuilder(
          data_id, column_type, "Col{}".format(++i), cfg
      )
      verify_builder(builder, lambda col: col.values[0] == 1)
  
      cfg = {"col": "str_num", "to": "float", "from": "str"}
      builder = ColumnBuilder(
          data_id, column_type, "Col{}".format(++i), cfg
      )
      verify_builder(builder, lambda col: col.values[0] == 1.5)
  
      cfg = {"col": "hex_int", "to": "int", "from": "str"}
      builder = ColumnBuilder(
          data_id, column_type, "Col{}".format(++i), cfg
      )
      verify_builder(builder, lambda col: col.values[0] == 1)
  
      cfg = {"col": "hex_float", "to": "float", "from": "str"}
      builder = ColumnBuilder(
          data_id, column_type, "Col{}".format(++i), cfg
      )
      verify_builder(builder, lambda col: col.values[0] == 1.5)
  
      df = pd.DataFrame(
          dict(
              a=[1, 2, 3, "", 5, 6, 7, 8, 9, 10],
              b=[
                  True,
                  True,
                  False,
                  "",
                  "False",
                  True,
                  False,
                  True,
                  False,
                  True,
              ],
              c=[
                  "1",
                  "00",
                  "1.05",
                  " ",
                  " ",
                  "",
                  "02",
                  "..",
                  "none",
                  "nan",
              ],
          )
      )
      build_data_inst({data_id: df})
  
      cfg = {"col": "a", "to": "float", "from": "mixed-integer"}
      builder = ColumnBuilder(
          data_id, column_type, "Col{}".format(++i), cfg
      )
      verify_builder(builder, lambda col: col.sum() == 51)
      assert np.isnan(builder.build_column().values[3])
  
      cfg = {"col": "b", "to": "bool", "from": "mixed-integer"}
      builder = ColumnBuilder(
          data_id, column_type, "Col{}".format(++i), cfg
      )
      verify_builder(builder, lambda col: col.sum() == 5)
      assert np.isnan(builder.build_column().values[3])
  
      cfg = {"col": "c", "to": "float", "from": "str"}
      builder = ColumnBuilder(
          data_id, column_type, "Col{}".format(++i), cfg
      )
      verify_builder(
          builder,
          lambda col: col.sum() == 4.05 and col.isnull().sum() == 6,
      )
  
file_path: dtale/tests/dtale/column_builders/test_type_conversion.py
imports: import numpy
  import pandas
  import pytest
  from dtale.column_builders import ColumnBuilder
  from tests.dtale.column_builders.test_column_builders import verify_builder
  from tests.dtale import build_data_inst
label_desc: Use image node_id 2 for calling a global function with example usage: test_from_string() without return types