rohdesamuel commented on a change in pull request #15072:
URL: https://github.com/apache/beam/pull/15072#discussion_r658921835
##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -1843,9 +1873,69 @@ def repeat(self, repeats, axis):
f"DeferredSeries (encountered {type(repeats)}).")
+def _justify_str_column(objs, rjust=True):
+ strs = [str(o) for o in objs]
+ maxlen = max(len(s) for s in strs)
+ return [s.rjust(maxlen) if rjust else s.ljust(maxlen) for s in strs]
+
+
+def _ljustify_str_column(objs):
+ strs = [str(o) for o in objs]
+ maxlen = max(len(s) for s in strs)
+ return [s.ljust(maxlen) for s in strs]
+
+
+def _justify_columns_and_transpose(columns, rjust=True):
+ for row in zip(*[_justify_str_column(objs, rjust) for objs in columns]):
+ yield ' '.join(row)
+
+
@populate_not_implemented(pd.DataFrame)
@frame_base.DeferredFrame._register_for(pd.DataFrame)
class DeferredDataFrame(DeferredDataFrameOrSeries):
Review comment:
Yeah, the first ten or so lines are the same for the series and frames,
maybe that can be pulled out?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]