class_docstr: Slope-by-segment transformation.
  
  Class to perform the Slope transformation on a time series
  dataframe. It splits a time series into num_intervals segments.
  Then within each segment, it performs a total least
  squares regression to extract the gradient of the segment.
  
  Parameters
  ----------
  num_intervals : int, number of approx equal segments
                  to split the time series into.
class_docstr_tok: ["Slope-by-segment","transformation",".","Class","to","perform","the","Slope","transformation","on","a","time","series","dataframe",".","It","splits","a","time","series","into","num_intervals","segments",".","Then","within","each","segment",",","it","performs","a","total","least","squares","regression","to","extract","the","gradient","of","the","segment",".","Parameters","--","--","--","--","--","num_intervals",":","int",",","number","of","approx","equal","segments","to","split","the","time","series","into","."]
docstr: Transform X and return a transformed version.
  
  private _transform containing core logic, called from transform
  
  Parameters
  ----------
  X : nested pandas DataFrame of shape [n_instances, n_features]
      each cell of X must contain pandas.Series
      Data to fit transform to
  y : ignored argument for interface compatibility
      Additional data, e.g., labels for transformation
  
  Returns
  -------
  Xt : nested pandas DataFrame of shape [n_instances, n_features]
      each cell of Xt contains pandas.Series
      transformed version of X
docstr_tok: ["Transform","X","and","return","a","transformed","version",".","private","_transform","containing","core","logic",",","called","from","transform","Parameters","--","--","--","--","--","X",":","nested","pandas","DataFrame","of","shape","[","n_instances",",","n_features","]","each","cell","of","X","must","contain","pandas.Series","Data","to","fit","transform","to","y",":","ignored","argument","for","interface","compatibility","Additional","data",",","e.g.",",","labels","for","transformation","Returns","--","--","--","-","Xt",":","nested","pandas","DataFrame","of","shape","[","n_instances",",","n_features","]","each","cell","of","Xt","contains","pandas.Series","transformed","version","of","X"]
code: def _transform(self, X, y=None):
      """Transform X and return a transformed version.
  
      private _transform containing core logic, called from transform
  
      Parameters
      ----------
      X : nested pandas DataFrame of shape [n_instances, n_features]
          each cell of X must contain pandas.Series
          Data to fit transform to
      y : ignored argument for interface compatibility
          Additional data, e.g., labels for transformation
  
      Returns
      -------
      Xt : nested pandas DataFrame of shape [n_instances, n_features]
          each cell of Xt contains pandas.Series
          transformed version of X
      """
      # Get information about the dataframe
      n_timepoints = len(X.iloc[0, 0])
      num_instances = X.shape[0]
      col_names = X.columns
  
      self._check_parameters(n_timepoints)
  
      Xt = pd.DataFrame()
  
      for x in col_names:
          # Convert one of the columns in the dataframe to numpy array
          arr = convert(
              pd.DataFrame(X[x]),
              from_type="nested_univ",
              to_type="numpyflat",
              as_scitype="Panel",
          )
  
          # Calculate gradients
          transformedData = []
          for y in range(num_instances):
              res = self._get_gradients_of_lines(arr[y])
              transformedData.append(res)
  
          # Convert to Numpy array
          transformedData = np.asarray(transformedData)
  
          # Add it to the dataframe
          colToAdd = []
          for i in range(len(transformedData)):
              inst = transformedData[i]
              colToAdd.append(pd.Series(inst))
  
          Xt[x] = colToAdd
  
      return Xt
  
file_path: sktime/sktime/transformations/panel/slope.py
imports: import math
  import statistics
  import numpy
  import pandas
  from sktime.datatypes import convert
  from sktime.transformations.base import BaseTransformer
label_desc: Use image node_id 2 for calling the SlopeTransformer obj's underlying member method code with example usage: obj._transform(X, y) and returns: Xt