← 返回题库
中级

Pandas apply函数

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve():
    import pandas as pd
    df = pd.read_csv(____)
    df['____'] = df.apply(____)
    print(df.head(____))

示例

输入
solve()
期望输出
date product region  quantity  price  total
0  2023-01-01  Laptop  North         5   1200   6000
1  2023-01-01   Phone  South        10    800   8000
2  2023-01-02  Laptop   East         3   1200   3600
3  2023-01-02  Tablet   West         7    500   3500
4  2023-01-03   Phone  North         8    800   6400
Python 代码 🔒 登录后使用
🔒

登录后即可练习

注册免费账号,在浏览器中直接运行 Python 代码