请您帮我在电报机器人中将数据帧作为表格发送。我在我的情况下使用aiogram。所以,这就是我写的:我使用<pre > 将我的数据帧y_data作为 html 表发送。
async def unsubscribe(message: types.Message):
remove_keyboard = types.ReplyKeyboardRemove()
if message.chat.id in BOT_ACCESS_ID:
df = read_file('metrics')
# add message with table
y_data = yesterday_data(df)
await bot.send_message(message.chat.id,
f"Data:\n<pre>{y_data}</pre>", parse_mode='html', reply_markup=markup, reply_to_message_id=message.message_id,)
else:
await bot.send_message(message.chat.id, "You have no access")
问题是收到的带有此类表的消息不包含所有列。下面的照片可以显示我从电报机器人收到的结果消息:
我想显示所有列并删除有关行和列的描述。你能帮我吗?
您可以使用pd.set_option('display.max_columns', None)
显示任意数量的列和pd.set_option('display.max_rows', None)
任意数量的行。
import pandas as pd
pd.set_option('display.max_columns', None)
# Your code here
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句