Introduction: According to pep-8 style, a line in python should be less than 79 characters. But many times, you can't finish a line within that. So what will be the solution for that? Solution: The solution is to continue the line by breaking it after some operator or a space. But to make sense that this is part of the same line; you need to provide backslash ("\") at the line end. Example: turn this following line: dataframe = prev_data.groupby(['cust_id','edge_id','edge_date']).mean().reset_index() into: dataframe = prev_data.groupby(['cust_id', \ 'edge_id','edge_date']).mean().reset_index() using backslash line break. Now you can write more clearer and nice pretty code using line break. Thanks for reading!
I write about machine learning models, python programming, web scraping, statistical tests and other coding or data science related things I find interesting. Read, learn and grow with me!