我的脚本正在做以下事情:
- 从二进制
trc
文件中读取时间序列(UHF 测量) - 裁剪某些区域(脉冲)并将它们中的每一个保存到
pd.DataFrame
- 将所有
DataFrames
保存到一个hdf5
文件中
这工作正常,但 tables
模块似乎为每个 DataFrame
抛出一个 NaturalNameWarning
。
这是 DataFrames
保存到 hdf5
的地方:
num = 0
for idx, row in df_oszi.iloc[peaks].iterrows():
start_peak = idx - 1*1e-3
end_peak = idx + 10*1e-3 #tges=11us
df_pos = df_oszi[start_peak:end_peak]
df_pos.to_hdf('pos.h5', key=str(num))
num += 1
输出:
Warning (from warnings module):
File "C:\Users\Artur\AppData\Local\Programs\Python\Python37\lib\site-packages\tables\path.py", line 157
check_attribute_name(name)
NaturalNameWarning: object name is not a valid Python identifier: '185'; it does not match the pattern ``^[a-zA-Z_][a-zA-Z0-9_]*$``; you will not be able to use natural naming to access this object; using ``getattr()`` will still work, though
最佳答案
只要您真的不打算使用表访问,您总是可以这样做。
import warnings
from tables import NaturalNameWarning
warnings.filterwarnings('ignore', category=NaturalNameWarning)
关于python - 如何摆脱 NaturalNameWarning?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58414068/