小编lov*_*veR的帖子

RemoveError: 'pyopenssl' 是 conda 的依赖项,无法从 conda 的运行环境中删除

我正在尝试在 Windows 10 上的 Ananconda 3.7 上安装和更新软件包。

当我运行代码时:

 conda update --all
Run Code Online (Sandbox Code Playgroud)

甚至

 conda install pandas
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

 RemoveError: 'pyopenssl' is a dependency of conda and cannot be removed from conda's operating environment
Run Code Online (Sandbox Code Playgroud)

我不确定这是为什么?也不确定是否pyopenssl应该删除这个包,如果它无论如何都会有所帮助。

python pyopenssl anaconda

5
推荐指数
1
解决办法
2024
查看次数

如果在多列上有条件,pandas 数据框中的新列无法获得预期值基础

我有一个 Pandas 数据框,其数据如下表所示:

Negative  Positive  Neutral
True      False     False
True      False     False
False     False     True
False     True      False
True      False     False
False     True      False
True      False     False
True      False     False
Run Code Online (Sandbox Code Playgroud)

我正在做的是创建一个新列(“总体”),并根据条件,如果列“正”的行值为真,总体列获得值“正”,如果列“负”为真,则总体将采用“负”或“中性”值:

def flag_df(df):
    if (df["Negative"] == "True") and (df["Positive"] == "False") and (df["Neutral"] == "False"):
        return "Negative"
    elif (df["Negative"] == "False") and (df["Positive"] == "True") and (df["Neutral"] == "False"):
        return "Positive"
    else :
        return "Neutral"

fdf['Overall'] = fdf.apply(flag_df, axis = 1)
Run Code Online (Sandbox Code Playgroud)

但不幸的是,我不知道我做错了什么,“总体”列中的所有观察结果都是“中立”的:

Negative    Positive    Neutral     Overall
True           False     False      Neutral …
Run Code Online (Sandbox Code Playgroud)

python if-statement python-3.x pandas

3
推荐指数
1
解决办法
182
查看次数

标签 统计

python ×2

anaconda ×1

if-statement ×1

pandas ×1

pyopenssl ×1

python-3.x ×1