创建一个 python 函数作为 store_id 和日期作为输入和输出作为前一个日期的销售额

问题描述 投票:0回答:0

store_id 销售日期 0 1 2023-1-2 11 1 2 2023-1-3 22 2 3 2023-1-4 33 3 1 2023-1-5 44 4 2 2023-1-6 55 5 3 2023-1-7 66 6 1 2023-1-8 77 7 2 2023-1-9 88 8 3 2023-1-10 99

我无法在面试中解决这个问题

这正是问的问题:

创建一个包含 3 列的数据集 – store_id、date、sales 创建 3 个 Store_id 每个 store_id 有 3 个连续的日期 销售额被记录为 9 行 我们正在考虑所有商店的相同 9 日期 销售额可以是任意随机数 2. 编写一个函数来获取一旦我们将 store_id 和日期作为输入

,前一天的销售额作为输出
python-3.x pandas filtering grouping datetime-format
© www.soinside.com 2019 - 2024. All rights reserved.