我有一个数据框,其中索引不是数字而是字符串(特别是国家/地区名称),并且它们都是唯一的。给定一个国家/地区的名称,如何找到其行号(索引的“数字”值)?
我尝试过df[df.index == 'country_name'].index,但这不起作用。
我不确定为什么这个管道会中断,我已经根据网站的确切说明在 Linux 上安装了 gstreamer,有什么想法吗?
gst-launch-1.0 v4l2src device=/dev/video0 ! videoscale ! video/x-raw, width=2592, height=600 ! autovideosink -v
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.000093207
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
Run Code Online (Sandbox Code Playgroud)
如果我把它改成:
gst-launch-1.0 v4l2src …Run Code Online (Sandbox Code Playgroud) .ipynb 文件的代码:
检测到Python:
该代码在 jupyter 笔记本中具有颜色:
我尝试在 anaconda 环境中的 VS Code 中设置 Jupyter Notebook。我尝试过 - Python: 选择解释器并选择了我的 anaconda 环境。确保 python 在环境中:python --version: Python 3.8.8。尝试单击 CVE(右下角)更改为 python(图 2)。代码的着色在 Jupyter Notebook 的交互窗口中运行良好(图 3)。
Traceback (most recent call last):
File "/opt/ros/melodic/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 50, in <module>
sys.argv, msg_template_map, srv_template_map)
File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/template_tools.py", line 213, in generate_from_command_line_options
generate_from_file(argv[1], options.package, options.outdir, options.emdir, options.includepath, msg_template_dict, srv_template_dict)
File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/template_tools.py", line 154, in generate_from_file
_generate_msg_from_file(input_file, output_dir, template_dir, search_path, package_name, msg_template_dict)
File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/template_tools.py", line 99, in _generate_msg_from_file
search_path)
File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/template_tools.py", line 77, in _generate_from_spec
interpreter = em.Interpreter(output=ofile, globals=g, options={em.RAW_OPT:True,em.BUFFERED_OPT:True})
AttributeError: 'module' object has no attribute 'RAW_OPT'
Traceback (most recent call last):
File "/opt/ros/melodic/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 50, in <module>
sys.argv, msg_template_map, srv_template_map)
File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/template_tools.py", …Run Code Online (Sandbox Code Playgroud)