class_docstr: Abstract base task class.
  
  A task encapsulates metadata information such as the feature and
  target variable which to fit the data to and additional necessary
  instructions on how to fit and predict.
  
  Implements attributes and operations shared by all tasks,
  including compatibility checks between the concrete task type and
  passed metadata.
  
  Parameters
  ----------
  target : str
      The column name for the target variable to be predicted.
  features : list of str, optional, (default=None)
      The column name(s) for the feature variable. If None, every column
      apart from target will be used as a feature.
  metadata : pandas.DataFrame
      Contains the metadata that the task is expected to work with.
class_docstr_tok: ["Abstract","base","task","class",".","A","task","encapsulates","metadata","information","such","as","the","feature","and","target","variable","which","to","fit","the","data","to","and","additional","necessary","instructions","on","how","to","fit","and","predict",".","Implements","attributes","and","operations","shared","by","all","tasks",",","including","compatibility","checks","between","the","concrete","task","type","and","passed","metadata",".","Parameters","--","--","--","--","--","target",":","str","The","column","name","for","the","target","variable","to","be","predicted",".","features",":","list","of","str",",","optional",",","(","default=None",")","The","column","name","(","s",")","for","the","feature","variable",".","If","None",",","every","column","apart","from","target","will","be","used","as","a","feature",".","metadata",":","pandas.DataFrame","Contains","the","metadata","that","the","task","is","expected","to","work","with","."]
docstr: Provide missing metadata information to task if not already set.
  
  This method is especially useful in orchestration where metadata may
  not be
  available when specifying the task.
  
  Parameters
  ----------
  metadata : pandas.DataFrame
      Metadata container
  
  Returns
  -------
  self : an instance of self
docstr_tok: ["Provide","missing","metadata","information","to","task","if","not","already","set",".","This","method","is","especially","useful","in","orchestration","where","metadata","may","not","be","available","when","specifying","the","task",".","Parameters","--","--","--","--","--","metadata",":","pandas.DataFrame","Metadata","container","Returns","--","--","--","-","self",":","an","instance","of","self"]
code: def set_metadata(self, metadata):
      """Provide missing metadata information to task if not already set.
  
      This method is especially useful in orchestration where metadata may
      not be
      available when specifying the task.
  
      Parameters
      ----------
      metadata : pandas.DataFrame
          Metadata container
  
      Returns
      -------
      self : an instance of self
      """
      # TODO replace whole pandas data container as input argument with
      #  separated metadata container
  
      # only set metadata if metadata is not already set, otherwise raise
      # error
      if self._metadata is not None:
          raise AttributeError(
              "Metadata is already set and can only be set once, create a "
              "new task for different metadata"
          )
  
      # check for consistency of information provided in task with given
      # metadata
      self.check_data_compatibility(metadata)
  
      # set default feature information (all columns but target) using
      # metadata
      if self.features is None:
          self._features = metadata.columns.drop(self.target)
  
      # set metadata
      self._metadata = {
          "nrow": metadata.shape[0],
          "ncol": metadata.shape[1],
          "target_type": {
              self.target: type(i) for i in metadata[self.target]
          },
          "feature_type": {
              col: {type(i) for i in metadata[col]}
              for col in self.features
          },
      }
      return self
  
imports: from inspect import signature
  import numpy
  import pandas
  from sktime.base import BaseObject
label_desc: Use image node_id 5 for calling the BaseTask obj's underlying member method code with example usage: obj.set_metadata(metadata) and returns: self