DataframeUtilities¶
-
class
mastml.legos.feature_generators.
DataframeUtilities
[source]¶ Bases:
object
Class of basic utilities for dataframe manipulation, and exchanging between dataframes and numpy arrays
Args:
NoneMethods:
merge_dataframe_columns : merge two dataframes by concatenating the column names (duplicate columns omitted)
Args:
dataframe1: (dataframe), a pandas dataframe object
dataframe2: (dataframe), a pandas dataframe object
Returns:
dataframe: (dataframe), merged dataframemerge_dataframe_rows : merge two dataframes by concatenating the row contents (duplicate rows omitted)
Args:
dataframe1: (dataframe), a pandas dataframe object
dataframe2: (dataframe), a pandas dataframe object
Returns:
dataframe: (dataframe), merged dataframeget_dataframe_statistics : obtain basic statistics about data contained in the dataframe
Args:
dataframe: (dataframe), a pandas dataframe objectReturns:
dataframe_stats: (dataframe), dataframe containing input dataframe statisticsdataframe_to_array : transform a pandas dataframe to a numpy array
Args:
dataframe: (dataframe), a pandas dataframe objectReturns:
array: (numpy array), a numpy array representation of the inputted dataframearray_to_dataframe : transform a numpy array to a pandas dataframe
Args:
array: (numpy array), a numpy arrayReturns:
dataframe: (dataframe), a pandas dataframe representation of the inputted numpy arrayconcatenate_arrays : merge two numpy arrays by concatenating along the columns
Args:
Xarray: (numpy array), a numpy array object
yarray: (numpy array), a numpy array object
Returns:
array: (numpy array), a numpy array merging the two input arraysassign_columns_as_features : adds column names to dataframe based on the x and y feature names
Args:
dataframe: (dataframe), a pandas dataframe object
x_features: (list), list containing x feature names
y_feature: (str), target feature name
Returns:
dataframe: (dataframe), dataframe containing same data as input, with columns labeled with featuressave_all_dataframe_statistics : obtain dataframe statistics and save it to a csv file
Args:
dataframe: (dataframe), a pandas dataframe object
data_path: (str), file path to save dataframe statistics to
Returns:
fname: (str), name of file dataframe stats saved toMethods Summary
array_to_dataframe
(array)assign_columns_as_features
(dataframe, …[, …])concatenate_arrays
(X_array, y_array)dataframe_to_array
(dataframe)get_dataframe_statistics
(dataframe)merge_dataframe_columns
(dataframe1, dataframe2)merge_dataframe_rows
(dataframe1, dataframe2)save_all_dataframe_statistics
(dataframe, …)Methods Documentation