Данные сетки для PandasPython

Программы на Python
Anonymous
Данные сетки для Pandas

Сообщение Anonymous »

Я разработал код, который успешно создает сетку, позволяет пользователю вводить данные и сохраняет их в списке. Однако когда я нажимаю кнопку сохранения данных сетки в pandas, возникает ошибка:
^^^^^^^^^^^^^^^^
File "c:\mainfol\mfatt\jeadomgrod.py", line 43, in topamda
df.at[i, j] = float(text1.get())
^^^^^
AttributeError: module 'pandas' has no attribute 'at'

import tkinter as tk
import pandas as pd

root = tk.Tk()
frame = tk.Frame(root)
frame.pack()

titles = ['A1', 'A2', 'A3', 'A4', 'A5', 'A6','A7', 'A8','A9','A10']
cells = []
for column, title in enumerate(titles):
# add column header labels
tk.Label(frame, text=title).grid(row=0, column=column)
cells. Append([])
for row in range(5): # add 5 rows of Entry widgets
text1 = tk.Entry(frame)
# row here is offset by +1 because the titles are using row 0
text1.grid(column=column, row=row + 1)
text1.insert(0, row)
cells[column].append(text1)

def topamda():
masterlines = []
df = pd
for i, row in enumerate(cells):
for j, text1 in enumerate(row):
df.at[i, j] = float(text1.get())
print(df)

button = tk.Button(root, text="Data to Pandas DF" , command = topamda)

button.pack()


Подробнее здесь: https://stackoverflow.com/questions/787 ... -to-pandas

Вернуться в «Python»