code: def tfidf(
      s: pd.Series,
      max_features=None,
      min_df=1,
      max_df=1.0,
  ) -> pd.DataFrame:
      """
      Represent a text-based Pandas Series using TF-IDF.
  
      Rows of the returned DataFrame represent documents whereas columns are
      terms. The value in the cell document-term is the tfidf-value of the
      term in this document. The output is sparse.
  
      *Term Frequency - Inverse Document Frequency (TF-IDF)* is a formula to
      calculate the _relative importance_ of the words in a document, taking
      into account the words' occurences in other documents. It consists of
      two parts:
  
      The *term frequency (tf)* tells us how frequently a term is present
      in a document, so tf(document d, term t) = number of times t appears
      in d.
  
      The *inverse document frequency (idf)* measures how _important_ or
      _characteristic_ a term is among the whole corpus (i.e. among all
      documents). Thus, idf(term t) = log((1 + number of documents) /
      (1 + number of documents where t is present)) + 1.
  
      Finally, tf-idf(document d, term t) = tf(d, t) * idf(t).
  
      Different from the `sklearn-implementation of tfidf
      <https://scikit-learn.org/stable/modules/generated/sklearn.feature_
      extraction.text.TfidfVectorizer.html>`, this function does *not*
      normalize the output in any way, so the result is exactly what you
      get applying the formula described above.
  
      The input Series should already be tokenized. If not, it will
      be tokenized before tfidf is calculated.
  
      Parameters
      ----------
      s : Pandas Series (tokenized)
  
      max_features : int, optional, default=None
          If not None, only the max_features most frequent tokens are used.
  
      min_df : float in range [0.0, 1.0] or int, optional, default=1
          When building the vocabulary ignore terms that have a document
          frequency (number of documents they appear in) strictly
          lower than the given threshold.
          If float, the parameter represents a proportion of documents,
          integer absolute counts.
  
      max_df : float in range [0.0, 1.0] or int, default=1.0
          Ignore terms that have a document frequency (number of documents they
          appear in) frequency strictly higher than the given threshold.
          This arguments basically permits to remove corpus-specific stop
          words. If float, the parameter represents a proportion of documents,
          integer absolute counts.
  
      Examples
      --------
      >>> import texthero as hero
      >>> import pandas as pd
      >>> s = pd.Series(["Hi Bye", "Test Bye Bye"]).pipe(hero.tokenize)
      >>> hero.tfidf(s) # doctest: +SKIP
          Bye        Hi      Test
      0   1.0  1.405465  0.000000
      1   2.0  0.000000  1.405465
  
      See Also
      --------
      `TF-IDF on Wikipedia <https://en.wikipedia.org/wiki/Tf-idf>`_
  
      TODO add tutorial link
      """
  
      # Check if input is tokenized. Else, print warning and tokenize.
      if not isinstance(s.iloc[0], list):
          warnings.warn(
              _not_tokenized_warning_message, DeprecationWarning
          )
          s = preprocessing.tokenize(s)
  
      tfidf = TfidfVectorizer(
          use_idf=True,
          max_features=max_features,
          min_df=min_df,
          max_df=max_df,
          tokenizer=lambda x: x,
          preprocessor=lambda x: x,
          norm=None,  # Disable l1/l2 normalization.
      )
  
      tfidf_vectors_csr = tfidf.fit_transform(s)
  
      return pd.DataFrame.sparse.from_spmatrix(
          tfidf_vectors_csr, s.index, tfidf.get_feature_names()
      )
  
imports: import pandas
  import numpy
  from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
  from sklearn.manifold import TSNE
  from sklearn.decomposition import PCA, NMF
  from sklearn.cluster import KMeans, DBSCAN, MeanShift
  from sklearn.metrics.pairwise import cosine_similarity
  from sklearn.preprocessing import normalize
  from scipy.sparse import coo_matrix
  from typing import Optional, Union, Any
  from texthero._types import TextSeries, TokenSeries, VectorSeries, DataFrame, InputSeries
  from texthero import preprocessing
  import logging
  import warnings
label_desc: Use image node_id 3 for calling a global function with example usage: tfidf(s, max_features, min_df, max_df) and returns: pd