class_docstr: Class which contains methods for data preprocessing.
  The class performs two types of preprocessing: obligatory and optional.
  
  obligatory - deletes rows where nans in the target, removes features,
      which full of nans, deletes extra_spaces
  optional - depends on what operations are in the pipeline, gap-filling
      is applied if there is no imputation operation in the pipeline, categorical
      encoding is applied if there is no encoder in the structure of the pipeline etc.
class_docstr_tok: ["Class","which","contains","methods","for","data","preprocessing",".","The","class","performs","two","types","of","preprocessing",":","obligatory","and","optional",".","obligatory","-","deletes","rows","where","nans","in","the","target",",","removes","features",",","which","full","of","nans",",","deletes","extra_spaces","optional","-","depends","on","what","operations","are","in","the","pipeline",",","gap-filling","is","applied","if","there","is","no","imputation","operation","in","the","pipeline",",","categorical","encoding","is","applied","if","there","is","no","encoder","in","the","structure","of","the","pipeline","etc","."]
docstr: Corrects shapes of tabular data or time series.
  
  Args:
      data: time series or tabular. In the first case must be 1d-array, in the second case must be
          two-dimensional arrays or array of (n, 1) for texts.
  
  Returns:
      corrected tabular data
docstr_tok: ["Corrects","shapes","of","tabular","data","or","time","series",".","Args",":","data",":","time","series","or","tabular",".","In","the","first","case","must","be","1d-array",",","in","the","second","case","must","be","two-dimensional","arrays","or","array","of","(","n",",","1",")","for","texts",".","Returns",":","corrected","tabular","data"]
code: def _correct_shapes(data: InputData) -> InputData:
      """
      Corrects shapes of tabular data or time series.
  
      Args:
          data: time series or tabular. In the first case must be 1d-array, in the second case must be
              two-dimensional arrays or array of (n, 1) for texts.
  
      Returns:
          corrected tabular data
      """
      if (
          data_type_is_table(data)
          or data.data_type is DataTypesEnum.multi_ts
      ):
          if np.ndim(data.features) < 2:
              data.features = data.features.reshape((-1, 1))
          if data.target is not None and np.ndim(data.target) < 2:
              data.target = data.target.reshape((-1, 1))
      elif data_type_is_text(data):
          data.features = data.features.reshape((-1, 1))
          if data.target is not None and np.ndim(data.target) < 2:
              data.target = np.array(data.target).reshape((-1, 1))
      elif data_type_is_ts(data):
          data.features = np.ravel(data.features)
  
      return data
  
imports: from copy import copy
  from typing import Optional, Union
  import numpy
  import pandas
  from golem.core.log import default_log
  from golem.core.paths import copy_doc
  from sklearn.preprocessing import LabelEncoder
  from fedot.core.data.data import InputData, np_datetime_to_numeric
  from fedot.core.data.data import OutputData, data_type_is_table, data_type_is_text, data_type_is_ts
  from fedot.core.data.data_preprocessing import data_has_categorical_features, data_has_missing_values, find_categorical_columns, replace_inf_with_nans, replace_nans_with_empty_strings
  from fedot.core.data.multi_modal import MultiModalData
  from fedot.core.operations.evaluation.operation_implementations.data_operations.categorical_encoders import LabelEncodingImplementation, OneHotEncodingImplementation
  from fedot.core.operations.evaluation.operation_implementations.data_operations.sklearn_transformations import ImputationImplementation
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.tasks import TaskTypesEnum
  from fedot.preprocessing.base_preprocessing import BasePreprocessor
  from fedot.preprocessing.categorical import BinaryCategoricalPreprocessor
  from fedot.preprocessing.data_type_check import exclude_image, exclude_multi_ts, exclude_ts
  from fedot.preprocessing.data_types import TYPE_TO_ID, TableTypesCorrector
  from fedot.preprocessing.structure import DEFAULT_SOURCE_NAME, PipelineStructureExplorer
label_desc: Use image node_id 23 for calling the DataPreprocessor obj's underlying member method code with example usage: obj._correct_shapes(data) and returns: data