Operasi matematika panda dari string
import pandas as pd
import numpy as np
df = pd.DataFrame(np.array([[1, 2], [4, 5], [7, 8]]), columns=['a', 'b'])
df.head()
# a b
# 0 1 2
# 1 4 5
# 2 7 8
df['c'] = eval( "df['a'] + df['b']" )
df.head()
# a b c
# 0 1 2 3
# 1 4 5 9
# 2 7 8 15
Thoughtless Tapir