Skip to content

Commit eed8907

Browse files
committed
Rename html_formatter to dataframe_formatter
1 parent f3c8c01 commit eed8907

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

python/datafusion/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
SQLOptions,
4848
)
4949
from .dataframe import DataFrame, ParquetColumnOptions, ParquetWriterOptions
50+
from .dataframe_formatter import configure_formatter
5051
from .expr import (
5152
Expr,
5253
WindowFrame,
5354
)
54-
from .html_formatter import configure_formatter
5555
from .io import read_avro, read_csv, read_json, read_parquet
5656
from .plan import ExecutionPlan, LogicalPlan
5757
from .record_batch import RecordBatch, RecordBatchStream

python/datafusion/dataframe.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import polars as pl
5353
import pyarrow as pa
5454

55-
from datafusion._internal import DataFrame as DataFrameInternal
5655
from datafusion._internal import expr as expr_internal
5756

5857
from enum import Enum
@@ -1112,3 +1111,17 @@ def fill_null(self, value: Any, subset: list[str] | None = None) -> DataFrame:
11121111
- For columns not in subset, the original column is kept unchanged
11131112
"""
11141113
return DataFrame(self.df.fill_null(value, subset))
1114+
1115+
@staticmethod
1116+
def default_str_repr(
1117+
batches: list[pa.RecordBatch],
1118+
schema: pa.Schema,
1119+
has_more: bool,
1120+
table_uuid: str | None = None,
1121+
) -> str:
1122+
"""Return the default string representation of a DataFrame.
1123+
1124+
This method is used by the default formatter and implemented in Rust for
1125+
performance reasons.
1126+
"""
1127+
return DataFrameInternal.default_str_repr(batches, schema, has_more, table_uuid)

python/datafusion/html_formatter.py renamed to python/datafusion/dataframe_formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def is_styles_loaded(cls) -> bool:
271271
True if styles have been loaded, False otherwise
272272
273273
Example:
274-
>>> from datafusion.html_formatter import DataFrameHtmlFormatter
274+
>>> from datafusion.dataframe_formatter import DataFrameHtmlFormatter
275275
>>> DataFrameHtmlFormatter.is_styles_loaded()
276276
False
277277
"""

python/tests/test_dataframe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
from datafusion import (
3838
functions as f,
3939
)
40-
from datafusion.expr import Window
41-
from datafusion.html_formatter import (
40+
from datafusion.dataframe_formatter import (
4241
DataFrameHtmlFormatter,
4342
configure_formatter,
4443
get_formatter,
4544
reset_formatter,
4645
reset_styles_loaded_state,
4746
)
47+
from datafusion.expr import Window
4848
from pyarrow.csv import write_csv
4949

5050
MB = 1024 * 1024

src/dataframe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ fn get_python_formatter_with_config(py: Python) -> PyResult<PythonFormatter> {
151151
Ok(PythonFormatter { formatter, config })
152152
}
153153

154-
/// Get the Python formatter from the datafusion.html_formatter module
154+
/// Get the Python formatter from the datafusion.dataframe_formatter module
155155
fn import_python_formatter(py: Python) -> PyResult<Bound<'_, PyAny>> {
156-
let formatter_module = py.import("datafusion.html_formatter")?;
156+
let formatter_module = py.import("datafusion.dataframe_formatter")?;
157157
let get_formatter = formatter_module.getattr("get_formatter")?;
158158
get_formatter.call0()
159159
}

0 commit comments

Comments
 (0)