code: def encode_df(df):
      df = encode_age(df)
      df = encode_fare(df)
      sex_mapping = {"male": 0, "female": 1}
      df = df.replace({"Sex": sex_mapping})
      embark_mapping = {"S": 1, "C": 2, "Q": 3}
      df = df.replace({"Embarked": embark_mapping})
      df.Embarked = df.Embarked.fillna(0)
      df["Company"] = 0
      df.loc[(df["SibSp"] > 0), "Company"] = 1
      df.loc[(df["Parch"] > 0), "Company"] = 2
      df.loc[(df["SibSp"] > 0) & (df["Parch"] > 0), "Company"] = 3
      df = df[
          [
              "PassengerId",
              "Pclass",
              "Sex",
              "Age",
              "Fare",
              "Embarked",
              "Company",
              "Survived",
          ]
      ]
      return df
  
file_path: gradio/demo/titanic_survival/run.py
imports: import os
  import pandas
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.model_selection import train_test_split
  import gradio
label_desc: Use image node_id 3 for calling a global function with example usage: encode_df(df) and returns: df