小编And*_*rea的帖子

如何解决 Gdk-CRITICAL **:17:13:03.280:gdk_cursor_new_for_display:断言“GDK_IS_DISPLAY(显示)”失败

升级到 ubuntu 20.04 后,我从 crontab 启动的 python 脚本收到此错误:

Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

(generate_clocks_graphs.py:4888): Gdk-CRITICAL **: 17:13:03.280: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
Run Code Online (Sandbox Code Playgroud)

有没有办法更好地理解这个错误?我找不到解决方案奇怪的是,如果我手动运行脚本,它可以完美运行

python ubuntu cron python-3.x

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

如何在Pandas中提取特定行

我有一只熊猫的df:

df['timestamp']
26600          58161.0
26628    58161.0416667
26656    58161.0833333
26684        58161.125
26712    58161.1666667
26740    58161.2083333
26768         58161.25
26796    58161.2916667
26824    58161.3333333
26852        58161.375
26880    58161.4166667
26908    58161.4583333
26936          58162.0
26964    58162.0416645
26992    58162.0833333
Run Code Online (Sandbox Code Playgroud)

我想只提取以".0"结尾的两行

我试过这个命令:

df['timestamp'].str.startswith(".0", na=False)
Run Code Online (Sandbox Code Playgroud)

但它返回:

AttributeError: 'Series' object has no attribute 'startswith'
Run Code Online (Sandbox Code Playgroud)

有一个简单的方法来完成这项工作吗?

谢谢

python object startswith pandas

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

Pandas:读取以特定字符串开头的跳过行

我有一个像这样的 Pandas DataFrame:

[6 rows x 5 columns]
name     timestamp         value1  state         value2
Cs01  1.514483e+09         19.516      0  9.999954e-01   
Cs02  1.514483e+09         20.055      0  9.999363e-01   
Cs03  1.514483e+09         20.054      0  9.999970e-01   
Cs01  1.514483e+09         20.055      0  9.999949e-01   
Cs01  1.514483e+09         10.907      0  9.963121e-01   
Cs02  1.514483e+09         10.092      0  1.548312e-02  
Run Code Online (Sandbox Code Playgroud)

read_csv 函数是否可以跳过所有不以名称“Cs01”开头的行?

谢谢

python pandas python-3.5

2
推荐指数
1
解决办法
5915
查看次数

标签 统计

python ×3

pandas ×2

cron ×1

object ×1

python-3.5 ×1

python-3.x ×1

startswith ×1

ubuntu ×1