Goal: make the following function PEP8 compliant. The second line is too long (>79 chars) and needs to be split up.
def a_function():
gdf_out = gdf_out.set_index(['level_0', 'level_1']).set_geometry('geometry')
This is a chained method. Following another answer results in:
def a_function():
gdf_out = (
gdf_out.set_index(['level_0', 'level_1'])
.set_geometry('geometry')
)
However this seems a bit odd to me, especially the indentation. Is there a better practice for chained commands in python PEP8?
What about this?
def a_function():
gdf_out = (gdf_out.set_index(['level_0', 'level_1'])
.set_geometry('geometry'))