小编Ron*_*th 的帖子

Python Pandas-选择多列为空的行

我想选择具有多列(以下示例中的 4 列)的行作为空值。我使用了以下代码:

data[(data['relevent_experience'].isnull())&data['education_level'].isnull())&data['major_disciplne'].isnull())&data['relevent_experience'].isnull())]
Run Code Online (Sandbox Code Playgroud)

这是一段非常复杂的代码。有没有更干净的方法来做同样的事情?

python null pandas

8
推荐指数
0
解决办法
2万
查看次数

从 jupyter notebook 运行 python 程序,同时将文件名作为参数传递

我正在尝试从 jupyter notebook 运行一个名为“Volatility_Spreadsheet_Prepare.py”的程序,同时将多个文件作为参数传递给程序。我的代码如下:

for filename in all_csv_files:
    %run 'Volatility_Spreadsheet_Prepare.py' filename
Run Code Online (Sandbox Code Playgroud)

此处all_csv_files包含当前目录中所有 CSV 文件的列表。该程序将文件名作为参数。

在这里,jupyter notebook 将文件名视为字符串,而我希望它考虑存储在 for 循环的变量“文件名”中的名称。我该怎么做呢?

python jupyter-notebook

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

标签 统计

python ×2

jupyter-notebook ×1

null ×1

pandas ×1