小编Sur*_*-da的帖子

Pandas 数据帧过滤多种条件

我有以下数据框

df = pd.DataFrame([[1990,7,1000],[1990,8,2500],[1990,9,2500],[1990,9,1500],[1991,1,250],[1991,2,350],[1991,3,350],[1991,7,450]], columns = ['year','month','data1'])

year    month    data1
1990      7      1000
1990      8      2500
1990      9      2500
1990      9      1500
1991      1      250
1991      2      350
1991      3      350
1991      7      450
Run Code Online (Sandbox Code Playgroud)

我想过滤数据,使其不包含月/年 07/1990、08/1990 和 01/1991 的数据。我可以为每个组合月/年做如下:

df = df.loc[(df.year != 1990) | (df.month != 7)]
Run Code Online (Sandbox Code Playgroud)

但是如果月/年有很多组合,则效率不高。有没有更有效的方法来做到这一点?

非常感谢。

python filter pandas

11
推荐指数
2
解决办法
607
查看次数

在没有 conda 的 Windows 上 pip install fbprophet

我想在 Windows 10 上安装 fbprophet 而不必安装 Anaconda。我有 python 3.7。我已经尝试了在 Windows 10 上安装 fbprophet Python 的所有建议,但没有成功。

到目前为止,我已经安装了 pystan,因为在安装 fbprophet 之前需要它,但是当我运行时pip install fbprophet,我得到了很多红色输出,并出现以下错误:

Building wheels for collected packages: fbprophet
Building wheel for fbprophet (setup.py) ... error
...
...
...
ImportError: DLL load failed: Specified module not found.
----------------------------------------
ERROR: Failed building wheel for fbprophet
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏。

python windows pip fbprophet

6
推荐指数
1
解决办法
480
查看次数

标签 统计

python ×2

fbprophet ×1

filter ×1

pandas ×1

pip ×1

windows ×1