Answers for "print conditional row dataframe"

5

make a condition statement on column pandas

df['color'] = ['red' if x == 'Z' else 'green' for x in df['Set']]
Posted by: Guest on May-12-2020
0

give cell format to condition pandas dataframe

import pandas as pd
df = pd.DataFrame([[2,3,1], [3,2,2], [2,4,4]], columns=list("ABC"))

df.style.apply(lambda x: ["background: red" if v > x.iloc[0] else "" for v in x], axis = 1)
Posted by: Guest on January-25-2021

Code answers related to "print conditional row dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language