def _write_block(self, f: "pyarrow.NativeFile", block: BlockAccessor, writer_args_fn: Callable[[], Dict[str, Any]] = lambda: {}, **writer_args): writer_args = _resolve_kwargs(writer_args_fn, **writer_args) orient = writer_args.pop("orient", "records") lines = writer_args.pop("lines", True) block.to_pandas().to_json(f, orient=orient, lines=lines, **writer_args)
def _zip(self, acc: BlockAccessor) -> "pandas.DataFrame": r = self.to_pandas().copy(deep=False) s = acc.to_pandas() for col_name in s.columns: col = s[col_name] # Ensure the column names are unique after zip. if col_name in r.column_names: i = 1 new_name = col_name while new_name in r.column_names: new_name = "{}_{}".format(col_name, i) i += 1 col_name = new_name r[col_name] = col return r
def _write_block(self, f: "pyarrow.NativeFile", block: BlockAccessor, **writer_args): orient = writer_args.pop("orient", "records") lines = writer_args.pop("lines", True) block.to_pandas().to_json(f, orient=orient, lines=lines, **writer_args)