I will introduce the writing method that I did not know & thought to imitate I think that you may execute many functions when performing data analysis or data preprocessing, but you can write the functions with line breaks by adding parentheses as shown below. I like this because it makes it easier to see.
import pandas as pd
from sklearn.datasets import load_iris
iris = load_iris()
(
data
.where(data['sepal length (cm)'] > 5)
.where(data['petal length (cm)'] > 5)
.sum()
)
that's all!
Recommended Posts