Skip to content

Commit

Permalink
removing unnecessary lambda function
Browse files Browse the repository at this point in the history
Co-authored-by: Lorin Dawson <[email protected]>
  • Loading branch information
tnixon and R7L208 authored Sep 22, 2023
1 parent 8cd949f commit f141f48
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions python/tempo/tsdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,11 @@ def __addPrefixToColumns(self, col_list: list[str], prefix: str) -> "TSDF":
# df = self.df.withColumnsRenamed(col_map)

# build a list of column expressions to rename columns in a select
rename_fn = (
lambda col: sfn.col(col).alias(col_map[col])
if col in col_map
select_exprs = [
sfn.col(col).alias(col_map[col] if col in col_map
else sfn.col(col)
)
select_exprs = [rename_fn(col) for col in self.df.columns]
for col in self.df.columns
]
# select the renamed columns
renamed_df = self.df.select(*select_exprs)

Expand Down

0 comments on commit f141f48

Please sign in to comment.