小编Jaq*_*har的帖子

比较Pandas Dataframe的列名

如何比较2个不同的Pandas数据框的列名。我想比较训练数据帧和测试数据帧,其中测试数据帧中缺少某些列?

python numpy machine-learning pandas data-science

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

在 Windows 上的 ubuntu 上的 bash 上安装 g++

当我尝试在 Windows 上的 ubuntu 上的 bash 上安装 g++ 时,出现错误

`

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.4.0-96.119_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/glibc/libc6-dev_2.23-0ubuntu9_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libstdc++-5-dev_5.4.0-6ubuntu1~16.04.4_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/g++-5_5.4.0-6ubuntu1~16.04.4_amd64.deb  404  Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.4.0-96.119_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/glibc/libc6-dev_2.23-0ubuntu9_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Failed to fetch …
Run Code Online (Sandbox Code Playgroud)

c++ windows bash ubuntu

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

在pandas数据帧中将'no'和'yes'转换为0和1

我想转换'edjefe'列的数据,其中包含int以及'yes'和'no'值.我的问题是我只想将'yes'和'no'映射到1和0并保持int值不变所以我写了这段代码

def foo(x):
if x == 'no':
    return 0
elif x == 'yes':
    return 1
else:
    return x
Run Code Online (Sandbox Code Playgroud)

df1.edjefe.map(lambda x : foo(x))

但我得到一个错误,因为,

RecursionError: maximum recursion depth exceeded while calling a Python object
Run Code Online (Sandbox Code Playgroud)

python pandas

3
推荐指数
2
解决办法
4459
查看次数

标签 统计

pandas ×2

python ×2

bash ×1

c++ ×1

data-science ×1

machine-learning ×1

numpy ×1

ubuntu ×1

windows ×1