|
13 | 13 | # See the License for the specific language governing permissions and |
14 | 14 | # limitations under the License. |
15 | 15 | # |
| 16 | +import numpy as np |
| 17 | + |
16 | 18 | from databricks import koalas as ks |
17 | 19 | from databricks.koalas.config import set_option, reset_option, option_context |
18 | 20 | from databricks.koalas.testing.utils import ReusedSQLTestCase |
@@ -81,3 +83,23 @@ def test_html_repr(self): |
81 | 83 | with option_context("display.max_rows", None): |
82 | 84 | kdf = ks.range(ReprTest.max_display_count + 1) |
83 | 85 | self.assertEqual(kdf._repr_html_(), kdf.to_pandas()._repr_html_()) |
| 86 | + |
| 87 | + def test_repr_float_index(self): |
| 88 | + kdf = ks.DataFrame({'a': np.random.rand(ReprTest.max_display_count)}, |
| 89 | + index=np.random.rand(ReprTest.max_display_count)) |
| 90 | + self.assertTrue("Showing only the first" not in repr(kdf)) |
| 91 | + self.assert_eq(repr(kdf), repr(kdf.to_pandas())) |
| 92 | + self.assertTrue("Showing only the first" not in repr(kdf.a)) |
| 93 | + self.assert_eq(repr(kdf.a), repr(kdf.a.to_pandas())) |
| 94 | + self.assertTrue("Showing only the first" not in repr(kdf.index)) |
| 95 | + self.assert_eq(repr(kdf.index), repr(kdf.index.to_pandas())) |
| 96 | + |
| 97 | + self.assertTrue("Showing only the first" not in kdf._repr_html_()) |
| 98 | + self.assertEqual(kdf._repr_html_(), kdf.to_pandas()._repr_html_()) |
| 99 | + |
| 100 | + kdf = ks.DataFrame({'a': np.random.rand(ReprTest.max_display_count + 1)}, |
| 101 | + index=np.random.rand(ReprTest.max_display_count + 1)) |
| 102 | + self.assertTrue("Showing only the first" in repr(kdf)) |
| 103 | + self.assertTrue("Showing only the first" in repr(kdf.a)) |
| 104 | + self.assertTrue("Showing only the first" in repr(kdf.index)) |
| 105 | + self.assertTrue("Showing only the first" in kdf._repr_html_()) |
0 commit comments