日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python抽取某个时间段的数据_python 批量提取excel 指定时间段的数据

發(fā)布時間:2023/12/14 python 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python抽取某个时间段的数据_python 批量提取excel 指定时间段的数据 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

[Python] 純文本查看 復(fù)制代碼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

總結(jié)

以上是生活随笔為你收集整理的python抽取某个时间段的数据_python 批量提取excel 指定时间段的数据的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。