prepare_for_visual()

home > kero > Documentation

prepare_for_visual() will automatically separate the defective and clean part of data frame. It is a method of the visual_lab object.

This method will store the input data frame as the property “df” of the object visual_lab. Then it will create 3 more objects make them the properties of visual_lab through the function data_sieve().

  1. original_data
  2. clean_data
  3. crippled_data

They will correspond to the (1) object that stores the original data, (2) object that stores the clean data, which is the data whose defective rows have been dropped and (3) the object that stores the crippled_data, which is the defective part of the data. Refer to the examples or respective documentation on how to access the data frames.

kero.DataHandler.DataVisual.py

class visual_lab:
  def prepare_for_visual(self,dataframe):
    return
dataframe (panda data frame) Panda dataframe.

Example usage 1.

import kero.DataHandler.RandomDataFrame as RDF
import kero.DataHandler.DataVisual as dv
import numpy as np

rdf = RDF.RandomDataFrame()
col1 = {"column_name": "first", "items": [1, 2, 3]}
itemlist = list(np.linspace(10, 20, 48))
col2 = {"column_name": "second", "items": itemlist}
col3 = {"column_name": "third", "items": ["gg", "not"]}
col4 = {"column_name": "fourth", "items": ["my", "sg", "id", "jp", "us", "bf"]}

df, _ = rdf.initiate_random_table(20, col1, col2, col3, col4, panda=True, with_unique_ID=None)

The above only creates random table. This function is used straight-forwardly by feeding it with a pandas data frame. This example also shows how the data are accessed.

vlab = dv.visual_lab()
vlab.prepare_for_visual(df)
#### for checking ####
print(vlab.df)
print("\nclean df:\n")
print(vlab.cleanD.clean_df)
print("\ncrippled df:\n")
print(vlab.crippledD.crippled_df)
print("\n\n")
#######################
vlab.generate_level_1_report(label_name="gg")

kero version: 0.1 and above