:py:mod:`abacusai.python_function`
==================================

.. py:module:: abacusai.python_function


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   abacusai.python_function.PythonFunction




.. py:class:: PythonFunction(client, notebookId=None, name=None, createdAt=None, functionVariableMappings=None, outputVariableMappings=None, functionName=None, pythonFunctionId=None, functionType=None, codeSource={})


   Bases: :py:obj:`abacusai.return_class.AbstractApiClass`

   Customer created python function

   :param client: An authenticated API Client instance
   :type client: ApiClient
   :param notebookId: The unique identifier of the notebook used to spin up the notebook upon creation.
   :type notebookId: str
   :param name: The name to identify the algorithm, only uppercase letters, numbers, and underscores allowed.
   :type name: str
   :param createdAt: The ISO-8601 string representing when the Python function was created.
   :type createdAt: str
   :param functionVariableMappings: A description of the function variables.
   :type functionVariableMappings: dict
   :param outputVariableMappings: A description of the variables returned by the function
   :type outputVariableMappings: dict
   :param functionName: The name of the Python function to be used.
   :type functionName: str
   :param pythonFunctionId: The unique identifier of the Python function.
   :type pythonFunctionId: str
   :param functionType: The type of the Python function.
   :type functionType: str
   :param codeSource: Information about the source code of the Python function.
   :type codeSource: CodeSource

   .. py:method:: __repr__()

      Return repr(self).


   .. py:method:: to_dict()

      Get a dict representation of the parameters in this class

      :returns: The dict value representation of the class parameters
      :rtype: dict


   .. py:method:: add_graph_to_dashboard(graph_dashboard_id, function_variable_mappings = None, name = None)

      Add a python plot function to a dashboard

      :param graph_dashboard_id: Unique string identifier for the graph dashboard to update.
      :type graph_dashboard_id: str
      :param function_variable_mappings: List of arguments to be supplied to the function as parameters, in the format [{'name': 'function_argument', 'variable_type': 'FEATURE_GROUP', 'value': 'name_of_feature_group'}].
      :type function_variable_mappings: dict
      :param name: Name of the added python plot
      :type name: str

      :returns: An object describing the graph dashboard.
      :rtype: GraphDashboard


   .. py:method:: validate_locally(kwargs = None)

      Validates a Python function by running it with the given input values in an local environment. Taking Input Feature Group as either name(string) or Pandas DataFrame in kwargs.

      :param kwargs: A dictionary mapping function arguments to values to pass to the function. Feature group names will automatically be converted into pandas dataframes.
      :type kwargs: dict

      :returns: The result of executing the python function
      :rtype: any

      :raises TypeError: If an Input Feature Group argument has an invalid type or argument is missing.
      :raises Exception: If an error occurs while validating the Python function.



