Z
Z
zxcsss2020-04-25 12:44:32
Python
zxcsss, 2020-04-25 12:44:32

How to update csv Python database?

There is a database that is updated every hour, how to update the csv file? for example through schedule or restart.

import json
from bot.bot import Bot
from bot.handler import MessageHandler, BotButtonCommandHandler, Filter
import pandas as pd
TOKEN = "....."
bot = Bot(token=TOKEN)

cases=pd.read_csv('cases.csv',sep=",",index_col='Country/Other')

def buttons_answer_cb(bot, event) :
  
def message_stat(bot, event) :
    message = event.text

    if message=="Испания":
        id = 'Spain'
   
        message_cb(bot,event)
    bot.send_text(chat_id=event.data['chat']['chatId'],
                  text=f"Данные по стране: ({cases.loc[id, 'New Cases']})"
                     
bot.dispatcher.add_handler(MessageHandler(callback=message_stat))
bot.dispatcher.add_handler(MessageHandler(filters=Filter.regexp("/start*"), callback=message_cb))
bot.dispatcher.add_handler(BotButtonCommandHandler(callback=buttons_answer_cb))

bot.start_polling()
bot.idle()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-04-25
@dimonchik2013

opened
rewritten
closed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question