У меня есть некоторые данные, готовые для отображения из базы данных Pandas, я хотел бы, чтобы они выглядели хорошо, но я только смог распечатать их как этикетку.и выглядит ужасноТакже я хотел бы сделать его прокручиваемым, но я совершенно новый в Киви.Я не смог заставить работать ни одно из решений в интернете.это мой код.
Я надеялся, что есть какая-то библиотека, которая будет обрабатывать панд Киви, но я не вижу ничего подобного.
любое предложение будет оценено, спасибоавансовый.
class ScatterTextWidget(BoxLayout):
''' this part we take the information from timestation website and start analyze it '''
item_to_display = ObjectProperty()
text_location = ObjectProperty()
input_date = ObjectProperty()
input_time = ObjectProperty()
def initialize_request(self):
''' Initial analysis and control flow of the class '''
location = self.text_location.text
date = self.input_date.text
time_raw = self.input_time.text
url = 'test.csv'
data = pd.read_csv(url)
time = self.time_format_checker(time_d=time_raw)
group_name = data[data["Time"] <= time]
duplicates_removed = group_name.drop_duplicates(subset="Name", keep='last')
punch_in_df = duplicates_removed[duplicates_removed.Activity.str.contains('Punch In')]
filtered_data = punch_in_df[punch_in_df.Department.str.contains(location)]
filtered_data.reset_index(inplace=True)
self.item_to_display.text = filtered_data[['Name', 'Department', 'Device', 'Time']].to_string()
это файл kivy --- Короткая версия:
#:import utils kivy.utils
#:import ListAdapter kivy.adapters.listadapter.ListAdapter
#:import ListItemButton kivy.uix.listview.ListItemButton
#:import main MainGui
<ScatterTextWidget>:
text_location:text_location
item_to_display:item_to_display
input_date:input_date
input_time:input_time
canvas.before:
Color:
rgb: utils.get_color_from_hex('#000131')
Rectangle:
pos: self.pos
size: self.size
BoxLayout:
orientation: "vertical"
BoxLayout:
canvas.before:
Color:
rgb: utils.get_color_from_hex('#00050c')
Rectangle:
pos: self.pos
size: self.size
Label:
id:item_to_display
pos_hint_y: 'top'
size_hint_y: .75
text: 'Please introduce the Date'
Я надеюсь получить что-то вроде этого:
Name | Department | Device | Time |
Rodriguez, Cesar |IT Department | IT Office | 6:00 |
Clarke, Gyles |Kent Avenue | Kent Device | 7:00 |