Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of NaturalNameWarning?

My script is doing following things:

  1. read time series from binary trc file (UHF Measurement)
  2. crop certain regions (Impulses) and save each of them into a pd.DataFrame
  3. save all DataFrames into one hdf5 file

This works fine but the tables module seems to throw a NaturalNameWarning for every single DataFrame.

This is where the DataFrames are saved to the 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

Output:

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
like image 737
Artur Müller Romanov Avatar asked Dec 06 '25 14:12

Artur Müller Romanov


1 Answers

You can always do this as long as you are not really going to use the table accessing.

import warnings
from tables import NaturalNameWarning
warnings.filterwarnings('ignore', category=NaturalNameWarning)
like image 170
El_que_no_duda Avatar answered Dec 09 '25 02:12

El_que_no_duda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!