def test_with_data_source(mpg_df): from pandas_visual_analysis import VisualAnalysis, DataSource df = mpg_df ds = DataSource(df) VisualAnalysis(ds)
def test_with_cat_cols(mpg_df): from pandas_visual_analysis import VisualAnalysis df = mpg_df VisualAnalysis( df, categorical_columns=["name", "origin", "model_year", "cylinders"])
def test_visual_analysis_alpha(mpg_df): from pandas_visual_analysis import VisualAnalysis VisualAnalysis(mpg_df, select_color="#323EEC", deselect_color="#8A8C93", alpha=0.75)
def test_visual_analysis_row_height_list(mpg_df): from pandas_visual_analysis import VisualAnalysis VisualAnalysis( mpg_df, layout=[["Scatter", "Scatter"], ["ParallelCoordinates"]], row_height=[200, 300], )
def test_visual_analysis_color_value_error(self, small_df): with pytest.raises(ValueError): VisualAnalysis(small_df, select_color=(500, 0, 0))
def test_visual_analysis_object_creation_deselect_color_type_error( self, small_df): with pytest.raises(TypeError): VisualAnalysis(small_df, deselect_color=set([0, 0, 0]))
def test_visual_analysis_object_creation_color_error2(self, small_df): with pytest.raises(ValueError): VisualAnalysis(small_df, select_color="#asdfasdfa")
def test_visual_analysis_row_height(mpg_df): from pandas_visual_analysis import VisualAnalysis VisualAnalysis(mpg_df, row_height=300)
def test_ipython_display(self, small_df): va = VisualAnalysis(small_df) va._ipython_display_()
def test_visual_analysis_sample_number_neg_error(self, int_df): with pytest.raises(ValueError): VisualAnalysis(int_df, sample=-100)
def test_visual_analysis_sample_input_error(self, int_df): with pytest.raises(TypeError): VisualAnalysis(int_df, sample="asdfa")
def test_visual_analysis_object_creation_non_int_index( self, small_df_index): assert VisualAnalysis(small_df_index)
def test_init_with_data_source(self, small_df): ds = DataSource(small_df, None) assert VisualAnalysis(data=ds)
def test_visual_analysis_row_height_neg_error(self, small_df): with pytest.raises(ValueError): VisualAnalysis(small_df, row_height=-10)
def test_visual_analysis_object_creation(self, small_df): assert VisualAnalysis(small_df)
def test_visual_analysis_row_height_type_error(self, small_df): with pytest.raises(TypeError): VisualAnalysis(small_df, row_height="100px")
def test_warn_cat_cols(self, small_df): small_df.drop(columns=["b"], inplace=True) with pytest.warns(UserWarning): VisualAnalysis(small_df, layout=[["ParallelCategories"]])
def test_visual_analysis_warn_num_cols(self, small_df): small_df.drop(columns=["c"], inplace=True) with pytest.warns(UserWarning): VisualAnalysis(small_df, layout=[["ParallelCoordinates"]])
def test_visual_analysis_object_creation_alpha_type_error(self, small_df): with pytest.raises(TypeError): VisualAnalysis(small_df, alpha=[0.5])
def test_data_type_error(self): with pytest.raises(TypeError): VisualAnalysis(data=[1, 2, 3])
def test_visual_analysis_alpha_error(self, small_df): with pytest.raises(ValueError): VisualAnalysis(small_df, alpha=1.4)
def test_visual_analysis_sample(mpg_df): from pandas_visual_analysis import VisualAnalysis va = VisualAnalysis(mpg_df, sample=100) assert len(va.data_source) == 100
def test_default(mpg_df): from pandas_visual_analysis import VisualAnalysis df = mpg_df VisualAnalysis(df)
df.isnull().sum() # In[14]: df_Train =df # # Data Analysis - Visualization and Exploration # In[15]: VisualAnalysis(df_Train) ##Interactive Dashboard #Each Metric can be used to select the required # In[16]: for indx in ['Income_of_Applicant', 'Income_of_Joint_Applicant', 'Loan_Amount_Requirement']: sns.boxplot(df_Train[indx].dropna(),orient='a') plt.title(indx) plt.show() # # Dealing with missing value # In[17]:
def test_visual_analysis_sample_frac_large_error(self, int_df): with pytest.raises(ValueError): VisualAnalysis(int_df, sample=10.4)
def test_visual_analysis_object_creation_color_high_value_error( self, small_df): with pytest.raises(ValueError): VisualAnalysis(small_df, deselect_color=(0, 0, 500))
def test_visual_analysis_color_tuple(self, small_df): assert VisualAnalysis(small_df, select_color=(12, 12, 12))
def test_visual_analysis_display_system(self, int_df): va = VisualAnalysis(int_df, [["Scatter"]]) from IPython.core.display import display display((va, ))
def test_visual_analysis_object_creation_color(self, small_df): assert VisualAnalysis(small_df, select_color="#ffffff", deselect_color=(0, 0, 0))
def test_widget_class_registry_normal_behaviour(): small_df = sample_dataframes.small_df() VisualAnalysis(small_df) assert len(WidgetClassRegistry().widget_list) > 0