Last active
December 12, 2018 13:46
-
-
Save wut0n9/004e2b20d4116314554ba5c56fc8c149 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# apply方法同时为多列赋值操作 | |
import pandas as pd | |
df = pd.read_excel('test.xlsx',encoding='utf8') | |
df[['col2', 'col3']] = df.apply(lambda row: ps.Series(func(row[0])), axis=1) | |
def func(col1): | |
# 为col2和col3赋同一值 | |
return col1, col1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment