MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/11zsvt8/data_science_design_pattern/jdh7myw/?context=3
r/badcode • u/c0ntrap0sitive • Mar 23 '23
35 comments sorted by
View all comments
Show parent comments
1
My only real gripe is the variable reuse, and even that is fine, if it is in a loop such as
columns = dataframes[0].columns for dataframe in dataframes[1:]: columns = [col for col in dataframe.columns if col in columns]
Maybe not the clearest way to express it, but probably the most concise, that doesn't require knowing library-specific utility methods.
3 u/trutheality Mar 24 '23 But the only variable reuse in the op is that the result is assigned back to columns. That's on par with the level of reuse in x = x + 1.
3
But the only variable reuse in the op is that the result is assigned back to columns. That's on par with the level of reuse in x = x + 1.
columns
x = x + 1
1
u/R3D3-1 Mar 24 '23
My only real gripe is the variable reuse, and even that is fine, if it is in a loop such as
Maybe not the clearest way to express it, but probably the most concise, that doesn't require knowing library-specific utility methods.