|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 | 15 |
|
| 16 | +import io |
| 17 | + |
16 | 18 | import pandas as pd
|
17 | 19 | import pytest
|
18 | 20 |
|
@@ -44,6 +46,38 @@ def test_null_index_materialize(scalars_df_null_index, scalars_pandas_df_default
|
44 | 46 | )
|
45 | 47 |
|
46 | 48 |
|
| 49 | +def test_null_index_info(scalars_df_null_index): |
| 50 | + expected = ( |
| 51 | + "<class 'bigframes.dataframe.DataFrame'>\n" |
| 52 | + "NullIndex\n" |
| 53 | + "Data columns (total 14 columns):\n" |
| 54 | + " # Column Non-Null Count Dtype\n" |
| 55 | + "--- ------------- ---------------- ------------------------------\n" |
| 56 | + " 0 bool_col 8 non-null boolean\n" |
| 57 | + " 1 bytes_col 6 non-null binary[pyarrow]\n" |
| 58 | + " 2 date_col 7 non-null date32[day][pyarrow]\n" |
| 59 | + " 3 datetime_col 6 non-null timestamp[us][pyarrow]\n" |
| 60 | + " 4 geography_col 4 non-null geometry\n" |
| 61 | + " 5 int64_col 8 non-null Int64\n" |
| 62 | + " 6 int64_too 9 non-null Int64\n" |
| 63 | + " 7 numeric_col 6 non-null decimal128(38, 9)[pyarrow]\n" |
| 64 | + " 8 float64_col 7 non-null Float64\n" |
| 65 | + " 9 rowindex_2 9 non-null Int64\n" |
| 66 | + " 10 string_col 8 non-null string\n" |
| 67 | + " 11 time_col 6 non-null time64[us][pyarrow]\n" |
| 68 | + " 12 timestamp_col 6 non-null timestamp[us, tz=UTC][pyarrow]\n" |
| 69 | + " 13 duration_col 7 non-null duration[us][pyarrow]\n" |
| 70 | + "dtypes: Float64(1), Int64(3), binary[pyarrow](1), boolean(1), date32[day][pyarrow](1), decimal128(38, 9)[pyarrow](1), duration[us][pyarrow](1), geometry(1), string(1), time64[us][pyarrow](1), timestamp[us, tz=UTC][pyarrow](1), timestamp[us][pyarrow](1)\n" |
| 71 | + "memory usage: 1269 bytes\n" |
| 72 | + ) |
| 73 | + |
| 74 | + bf_result = io.StringIO() |
| 75 | + |
| 76 | + scalars_df_null_index.drop(columns="rowindex").info(buf=bf_result) |
| 77 | + |
| 78 | + assert expected == bf_result.getvalue() |
| 79 | + |
| 80 | + |
47 | 81 | def test_null_index_series_repr(scalars_df_null_index, scalars_pandas_df_default_index):
|
48 | 82 | bf_result = scalars_df_null_index["int64_too"].head(5).__repr__()
|
49 | 83 | pd_result = (
|
|
0 commit comments