Пример #1
0
 def test_sampled_plot_with_ratio(self):
     with option_context("plotting.sample_ratio", 0.5):
         pdf = pd.DataFrame(np.random.rand(2500, 4),
                            columns=["a", "b", "c", "d"])
         kdf = ks.from_pandas(pdf)
         data = SampledPlot().get_sampled(kdf)
         self.assertEqual(round(len(data) / 2500, 1), 0.5)
Пример #2
0
 def test_sampled_plot_with_max_rows(self):
     # 'plotting.max_rows' is 2000
     pdf = pd.DataFrame(np.random.rand(2000, 4),
                        columns=["a", "b", "c", "d"])
     kdf = ks.from_pandas(pdf)
     data = SampledPlot().get_sampled(kdf)
     self.assertEqual(round(len(data) / 2000, 1), 1)
Пример #3
0
 def test_sampled_plot_with_ratio(self):
     set_option('plotting.sample_ratio', 0.5)
     try:
         pdf = pd.DataFrame(np.random.rand(2500, 4), columns=['a', 'b', 'c', 'd'])
         kdf = koalas.from_pandas(pdf)
         data = SampledPlot().get_sampled(kdf)
         self.assertEqual(round(len(data) / 2500, 1), 0.5)
     finally:
         set_option('plotting.sample_ratio', DataFramePlotTest.sample_ratio_default)