python抽取某个时间段的数据_python 批量提取excel 指定时间段的数据
[Python] 純文本查看 復制代碼import pandas as pd
import os
import datetime
path = r'C:\Users\plm\Desktop\text1'
files = os.listdir(path)
for file in files:
df =pd.read_excel(file)
Traceback (most recent call last):
File "", line 12, in
df =pd.read_excel(file)
File "D:\ProgramData\Anaconda3\lib\site-packages\pandas\util\_decorators.py", line 296, in wrapper
return func(*args, **kwargs)
File "D:\ProgramData\Anaconda3\lib\site-packages\pandas\io\excel\_base.py", line 304, in read_excel
io = ExcelFile(io, engine=engine)
File "D:\ProgramData\Anaconda3\lib\site-packages\pandas\io\excel\_base.py", line 867, in __init__
self._reader = self._engines[engine](self._io)
File "D:\ProgramData\Anaconda3\lib\site-packages\pandas\io\excel\_xlrd.py", line 22, in __init__
super().__init__(filepath_or_buffer)
File "D:\ProgramData\Anaconda3\lib\site-packages\pandas\io\excel\_base.py", line 353, in __init__
self.book = self.load_workbook(filepath_or_buffer)
File "D:\ProgramData\Anaconda3\lib\site-packages\pandas\io\excel\_xlrd.py", line 37, in load_workbook
return open_workbook(filepath_or_buffer)
File "D:\ProgramData\Anaconda3\lib\site-packages\xlrd\__init__.py", line 111, in open_workbook
with open(filename, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'a.xlsx'
index = (df.iloc[(df['datetime2'] > 2020-11-2)].index)
Traceback (most recent call last):
File "", line 1, in
index = (df.iloc[(df['datetime2'] > 2020-11-2)].index)
NameError: name 'df' is not defined
ndf = df.drop(index)
Traceback (most recent call last):
File "", line 1, in
ndf = df.drop(index)
NameError: name 'df' is not defined
ndf.to_excel(file)
Traceback (most recent call last):
File "", line 1, in
ndf.to_excel(file)
NameError: name 'ndf' is not defined
ndf = df.drop(index)
Traceback (most recent call last):
File "", line 1, in
ndf = df.drop(index)
NameError: name 'df' is not defined
總結
以上是生活随笔為你收集整理的python抽取某个时间段的数据_python 批量提取excel 指定时间段的数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java p2p实例_java文件p2p
- 下一篇: java修改文件的名称_Java修改文件