我是python初学者。我有包含 5 个表的数据库,我使用 python 使用 asammdf 将所有这些表导出到 mdf 文件。
path_data = os.path.join('..\\Data', 'db_2021-05-06_11-49-42_day.db')
con = sqlite3.connect(path_data)
cursor = con.cursor()
cursor.execute('SELECT name FROM sqlite_master WHERE type="table";')
tables = cursor.fetchall()
print(tables)
sigs = []
for equipment in tables:
df = pd.read_sql_query('select * from' + equipment , con)
df_small = df[0:1000]
df_time = (df_small['ts']-df_small.iloc[0]['ts'])
df_time_int = df_time.astype('int64')
for signal in df_small.columns.to_list():
test_signal = Signal(samples=df_small[signal], timestamps=df_time,
name=signal,
unit='A')
sigs.append(test_signal)
mdf.append(sigs)
mdf.save('test_complete.mf4', overwrite=True)
我发现这个错误:
TypeError Traceback (most recent call last)
c:\Users\Muhammad Lazaroni\SW_Workspace\MeasurementMerger\Scripts\merger.py in
37 # table_list= list[tables]
38 for equipment in tables:
----> 39 df = pd.read_sql_query('select * from' + equipment , con)
40 df_small = df[0:1000]
41 df_time = (df_small['ts']-df_small.iloc[0]['ts'])
TypeError: can only concatenate str (not "tuple") to str