Buna, stie cineva sa ma ajute la codul asta in Python?
import pandas as pd
import selenium
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import tkinter
from selenium.webdriver.common.by import By
except Exception as e:
print(f"An error occurred: {e}")
return pd.DataFrame()
def create_chart():
global DataFrame_a
DataFrame_a = get_description()
DataFrame_a.plot.barh(x="Product", y="Price")
print("Horizontal bar chart has been created.")
def display_matrix():
global DataFrame_a
DataFrame_a = get_description()
print(DataFrame_a)
def save_to_excel():
global DataFrame_a
DataFrame_a = get_description()
file_name = text_box.get()
DataFrame_a.to_excel(file_name + "sofasofa.xlsx")
print('Matrix has been saved to Excel file "', file_name, '".')
Label = tkinter.Label(MainForm, text="Please enter filename:")
Label.pack()
text_box = tkinter.Entry(MainForm, width=25)
text_box.pack(pady=11)
Button4 = tkinter.Button(MainForm, text="Save to Excel", command=save_to_excel)
Button4.pack()
This above is the code
and the error is this:
Exception in Tkinter callback
Traceback (most recent call last):
File "\anaconda3\lib\tkinter\_init.py", line 1892, in __call_
return self.func(*args)
File "\Desktop\test.py", line 41, in create_chart
DataFrame_a.plot.barh(x="Product", y="Price")
File "anaconda3\lib\site-packages\pandas\plotting\_core.py", line 1216, in barh
return self(kind="barh", x=x, y=y, **kwargs)
File "anaconda3\lib\site-packages\pandas\plotting\core.py", line 972, in __call_
return plot_backend.plot(data, kind=kind, **kwargs)
File "anaconda3\lib\site-packages\pandas\plotting\matplotlib\init_.py", line 71, in plot
plot_obj.generate()
File "\anaconda3\lib\site-packages\pandas\plotting\_matplotlib\core.py", line 295, in generate
self._post_plot_logic(ax, self.data)
File "anaconda3\lib\site-packages\pandas\plotting\_matplotlib\core.py", line 1528, in _post_plot_logic
s_edge = self.ax_pos[0] - 0.25 + self.lim_offset
IndexError: index 0 is out of bounds for axis 0 with size 0
Vă mulțumim că ați ales să vizitați platforma noastră dedicată Informatică. Sperăm că informațiile disponibile v-au fost utile. Dacă aveți întrebări suplimentare sau aveți nevoie de sprijin, nu ezitați să ne contactați. Vă așteptăm cu drag și data viitoare! Nu uitați să adăugați site-ul nostru la favorite pentru acces rapid.