Starting with a pandas DataFrame such as
import pandas as pd
df = pd.DataFrame(
[[0, 3, 1.4, 3], [0, 3, 1.3, 1], [0, 3, 0.5, 3]]
)
or visually:
0 1 2 3
0[[0, 3, 1.4, 3]
1 [0, 3, 1.3, 1]
1 [0, 3, 0.5, 3]]
and given a special value x_1=3
What would be a smart and scaling way to come up with a DataFrame that deletes all columns in df with a constant value x in EACH row?
The result in this example would be the dataFrame df without column 1.
df_altered =
0 1 2
0[[0, 1.4, 3]
1 [0, 1.3, 1]
2 [0, 0.5, 3]]
In a small DataFrame I could itterate over all rows for each column but that would not scale and work with large DataFrames.
