0

I am developing simple telegram bot that should send dataframe to the chat. The problem is that the dataframe gets distorted (it has 5 columns). I was thinking about 2 solutions:

  1. Make a picture and then send it to the chat. The problem is that you have to save picture locally (i need the chat bot to work instantly). Do you know how to save dataframe to png with paramiko directly to SSH?
  2. Format table, but seems it does not work

Thank you!

Advises or sample coded or examples

1 Answers1

1

Take a look at this question (converting dataframe to png). Showing dataframe in the message is not a very good idea. I think the best solution here is to generate .txt or .csv file and send it to user. Users on the phones should be able to open these files with ease (by tapping on them).

Jenia
  • 374
  • 1
  • 4
  • 15
  • What about saving image virtually? Is there anyway to store it n variable or upload directly to server and then pull it? – Алексей Котов Nov 12 '22 at 02:07
  • @АлексейКотов Not sure. I'm not sure why do you need to store image as variable. I don't know what kind of structure your bot has (please provide more details next time when asking a question on StackOverflow), but I guess you're having problems with sending files over the internet. Take a look at [here](https://www.thepythoncode.com/article/send-receive-files-using-sockets-python). Or [here](https://stackoverflow.com/questions/68477/send-file-using-post-from-a-python-script) if you are working with web-server. – Jenia Nov 12 '22 at 09:19