pycodestyle icon indicating copy to clipboard operation
pycodestyle copied to clipboard

E127: method chaining

Open fgotzens opened this issue 5 years ago • 7 comments

I use method chaining in pandas very often, for example

import pandas as pd
df = (pd.read_csv('very/long/path/to/file/abcdefghijklmnopqrstuvwxyz.csv',
                  index_col='bar', encoding='utf-8')
        .drop(labels='baz', axis=1))

in which I indent the lines according to the first dot . after pd.

Now sometimes, this works: working

but also sometimes it doesn't, for example when the first part exceeds into a new line: not_working

Any idea what's going wrong here?

I am using Spyder 4.0.0 | Python 3.7.3 64-bit | Windows 10

fgotzens avatar Dec 18 '19 09:12 fgotzens