panda add several new columns based on values from other columns at the same time?
问题 How to add several new columns based on values from other columns at the same time ? I only found examples to add a row one at a time. I am able to add 3 new columns but this does not seem efficient since it has to go through all the rows 3 times. Is there a way to traverse the DF once? import pandas as pd from decimal import Decimal d = [ {'A': 2, 'B': Decimal('628.00')}, {'A': 1, 'B': Decimal('383.00')}, {'A': 3, 'B': Decimal('651.00')}, {'A': 2, 'B': Decimal('575.00')}, {'A': 4, 'B':