code: def format_number(x, floating_point: int = 2) -> str:
      """Format number for elegant display.
  
      Parameters
      ----------
      x
          Number to be displayed
      floating_point : int , default: 2
          Number of floating points to display
      Returns
      -------
      str
          String of beautified number
      """
  
      def add_commas(x):
          return f"{x:,}"  # yes this actually formats the number 1000 to "1,000"
  
      if np.isnan(x):
          return "nan"
  
      # 0 is lost in the next if case, so we have it here as a special use-case
      if x == 0:
          return "0"
  
      # If x is a very small number, that would be rounded to 0, we would prefer to return it as the format 1.0E-3.
      if abs(x) < 10 ** (-floating_point):
          return f"{Decimal(x):.{floating_point}E}"
  
      # If x is an integer, or if x when rounded is an integer (e.g. 1.999999), then return as integer:
      if round(x) == round(x, floating_point):
          return add_commas(round(x))
  
      # If not, return as a float, but don't print unnecessary zeros at end:
      else:
          ret_x = round(x, floating_point)
          return add_commas(ret_x).rstrip("0")
  
imports: import io
  import itertools
  import json
  import os
  import random
  import re
  import sys
  import typing
  from collections import defaultdict
  from copy import copy
  from datetime import datetime
  from decimal import Decimal
  from string import ascii_uppercase, digits
  import numpy
  import pandas
  from ipywidgets import Widget
  from ipywidgets.embed import dependency_state, embed_data, escape_script, snippet_template, widget_view_template
  from packaging.version import Version
  from pandas.core.dtypes.common import is_numeric_dtype
  import deepchecks
  from deepchecks import core
  from deepchecks.core.resources import jupyterlab_plotly_script, requirejs_script, suite_template, widgets_script
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 18 for calling a global function with example usage: format_number(x, floating_point) and returns: x, str, str, Decimal, add_commas, add_commas