code: def infer_frequency(df, time_column, default=DEFAULT_FREQUENCY):
      try:  # infer frequency from time column
          date_series = pd.to_datetime(
              df.sort_values(by=time_column)[time_column]
          ).unique()
          inferred_freq = pd.infer_freq(
              date_series
          )  # call this first to get e.g. months & other irregular periods right
          if inferred_freq is None:
              values, counts = np.unique(
                  np.diff(date_series), return_counts=True
              )
              delta = values[np.argmax(counts)]
              inferred_freq = to_offset(pd.to_timedelta(delta)).freqstr
      except TypeError:
          inferred_freq = default
      return inferred_freq if inferred_freq is not None else default
  
file_path: mindsdb/mindsdb/integrations/utilities/time_series_utils.py
imports: import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  from sklearn.metrics import r2_score
  from mindsdb.utilities import log
label_desc: Use image node_id 3 for calling a global function with example usage: infer_frequency(df, time_column, default) and returns: unknown