Method_chaining¶
Sourcery rule id: method_chaining¶
Description¶
Chaining methods improves readability
Before¶
df = df.drop_duplicates() df = df.reset_index(drop=True) After¶
df = df.drop_duplicates().reset_index(drop=True) Explanation¶
Chaining methods together can improve readability and performance in Pandas. Instead of applying methods one after another, try chaining them together to create a single expression.