code: def compute_numerical_statistics(
      df: pl.dataframe.frame.DataFrame,
      column_name: str,
      n_bins: int,
      n_samples: int,
      column_type: ColumnType,
  ) -> NumericalStatisticsItem:
      logging.debug(
          f"Compute min, max, mean, median, std and proportion of null values for {column_name=}. "
      )
      col_stats = dict(
          min=pl.all().min(),
          max=pl.all().max(),
          mean=pl.all().mean(),
          median=pl.all().median(),
          std=pl.all().std(),
          nan_count=pl.all().null_count(),
      )
      stats_names = pl.Series(col_stats.keys())
      stats_expressions = [
          pl.struct(stat) for stat in col_stats.values()
      ]
      stats = (
          df.select(pl.col(column_name))
          .select(
              name=stats_names,
              stats=pl.concat_list(stats_expressions).flatten(),
          )
          .unnest("stats")
      )
      minimum, maximum, mean, median, std, nan_count = stats[
          column_name
      ].to_list()
      nan_count = int(nan_count)
  
      if column_type == ColumnType.FLOAT:
          minimum, maximum, mean, median, std = np.round(
              [minimum, maximum, mean, median, std], DECIMALS
          ).tolist()
      elif column_type == ColumnType.INT:
          mean, median, std = np.round(
              [mean, median, std], DECIMALS
          ).tolist()
          minimum, maximum = int(minimum), int(maximum)
      else:
          raise ValueError(
              f"Incorrect column type of {column_name=}: {column_type}"
          )
      nan_proportion = (
          np.round(nan_count / n_samples, DECIMALS).item()
          if nan_count
          else 0.0
      )
      logging.debug(
          f"{minimum=}, {maximum=}, {mean=}, {median=}, {std=}, {nan_count=} {nan_proportion=}"
      )
  
      hist = compute_histogram(
          df,
          column_name=column_name,
          column_type=column_type,
          min_value=minimum,
          max_value=maximum,
          n_bins=n_bins,
          n_samples=n_samples - nan_count,
      )
  
      return NumericalStatisticsItem(
          nan_count=nan_count,
          nan_proportion=nan_proportion,
          min=minimum,
          max=maximum,
          mean=mean,
          median=median,
          std=std,
          histogram=hist,
      )
  
imports: import enum
  import logging
  import os
  from pathlib import Path
  from typing import Any, Optional, TypedDict, Union
  import numpy
  import polars
  from datasets import ClassLabel, Features
  from huggingface_hub import hf_hub_download
  from libcommon.exceptions import CacheDirectoryNotInitializedError, NoSupportedFeaturesError, ParquetResponseEmptyError, PreviousStepFormatError, SplitWithTooBigParquetError, StatisticsComputationError
  from libcommon.simple_cache import get_previous_step_or_raise
  from libcommon.storage import StrPath
  from libcommon.utils import JobInfo
  from requests.exceptions import ReadTimeout
  from tqdm import tqdm
  from worker.config import AppConfig, DescriptiveStatisticsConfig
  from worker.dtos import CompleteJobResult
  from worker.job_runners.split.split_job_runner import SplitJobRunnerWithCache
  from worker.utils import HF_HUB_HTTP_ERROR_RETRY_SLEEPS, retry
label_desc: Use image node_id 3 for calling a global function with example usage: compute_numerical_statistics(df, column_name, n_bins, n_samples, column_type) and returns: NumericalStatisticsItem