re.search() 可以跳过整数对象吗?

问题不言自明。我在包含 int 和 str 对象的 Pandas 数据框中有一列。当我尝试使用 re.search() 搜索它时,它无法运行,因为(我相信)某些列包含整数并且它不知道该怎么做。

有没有办法解决这个问题?我没有看到忽略错误的论点。


森林海
浏览 177回答 1
1回答

慕侠2389804

当我尝试运行以下代码时,我不知道如何修复此错误:df = wrapper.read_pdf(r'C:\End_to_End\1902\PN\Scenario1_AllCorrectMin\EPR.pdf')日志:FileNotFoundError&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Traceback (most recent call last)~\AppData\Local\Continuum\anaconda3\lib\site-packages\tabula\wrapper.py in read_pdf(input_path, output_format, encoding, java_options, pandas_options, multiple_tables, **kwargs)&nbsp; &nbsp; 107&nbsp; &nbsp; &nbsp;try:--> 108&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;output = subprocess.check_output(args)&nbsp; &nbsp; 109&nbsp;~\AppData\Local\Continuum\anaconda3\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)&nbsp; &nbsp; 335&nbsp; &nbsp; &nbsp;return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,--> 336&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; **kwargs).stdout&nbsp; &nbsp; 337&nbsp;~\AppData\Local\Continuum\anaconda3\lib\subprocess.py in run(input, timeout, check, *popenargs, **kwargs)&nbsp; &nbsp; 402&nbsp;--> 403&nbsp; &nbsp; &nbsp;with Popen(*popenargs, **kwargs) as process:&nbsp; &nbsp; 404&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;try:~\AppData\Local\Continuum\anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)&nbsp; &nbsp; 708&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;errread, errwrite,--> 709&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;restore_signals, start_new_session)&nbsp; &nbsp; 710&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;except:~\AppData\Local\Continuum\anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)&nbsp; &nbsp; 996&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; os.fspath(cwd) if cwd is not None else None,--> 997&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startupinfo)&nbsp; &nbsp; 998&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;finally:FileNotFoundError: [WinError 2] The system cannot find the file specifiedDuring handling of the above exception, another exception occurred:JavaNotFoundError&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Traceback (most recent call last)<ipython-input-3-010e34a004ec> in <module>()----> 1 df = wrapper.read_pdf(r'C:\End_to_End\1902\PN\Scenario1_AllCorrectMin\EPR.pdf')~\AppData\Local\Continuum\anaconda3\lib\site-packages\tabula\wrapper.py in read_pdf(input_path, output_format, encoding, java_options, pandas_options, multiple_tables, **kwargs)&nbsp; &nbsp; 109&nbsp;&nbsp; &nbsp; 110&nbsp; &nbsp; &nbsp;except FileNotFoundError as e:--> 111&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;raise JavaNotFoundError(JAVA_NOT_FOUND_ERROR)&nbsp; &nbsp; 112&nbsp;&nbsp; &nbsp; 113&nbsp; &nbsp; &nbsp;except subprocess.CalledProcessError as e:JavaNotFoundError: `java` command is not found from this Python process. Please ensure Java is installed and PATH is set for `java`我尝试在环境变量中更改和创建路径,但没有奏效。这是屏幕截图:
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python