Ejemplo n.º 1
0
    def testStats(self):
        # Testing if the dfSummary method returns a dataframe
        self.assertIsInstance(stats.dfSummary(self.df), pd.DataFrame)

        # Testing if the dataframe returned by dfSummary conains 8 rows
        self.assertEqual(len(stats.dfSummary(self.df)), 8)

        # Testing if the 'max' row in '0' column has value 30
        self.assertEqual(stats.dfSummary(self.df).loc['max', 0], 30)

        # Testing if the colBoxPlot method fails to plot from non-numeric data
        self.assertFalse(stats.colBoxPlot(pd.DataFrame(['a', 'b'])))

        # Testing if the colBoxPlot method successfully plots from numeric data
        self.assertTrue(stats.colBoxPlot(self.df))
Ejemplo n.º 2
0
import xuebadb.dbgeneric.db_interface as dbintfc
import xuebadb.dfanalysis.cleanup as cleanup
import xuebadb.dfanalysis.stats as stats
import testsuite

# Testing out connectivity to a MySQL DB server using the package
res_con = dbintfc.DBInterface('mysql', 'cosc304.ok.ubc.ca', 'vbalaji', '10796456', 'WorksOn')
res_df = res_con.querySelect("select * from dept")
cleanup.show_nulls(res_df)
print(res_df)
print(stats.dfSummary(res_df))

# Testing out connectivity to a SQL server DB using the package
res_con = dbintfc.DBInterface('sql_server', 'sql04.ok.ubc.ca', 'rlawrenc', 'test', 'workson')
res_df = res_con.querySelect("select * from emp")
cleanup.show_nulls(res_df)
print(res_df)
stats.colBoxPlot(res_df)

# Running the xuebadb package test-suite
testsuite.testSuite()