Sunday, November 14, 2021

[SOLVED] How can I send (request.post) pandas dataframe/json to my raspberry-pi webserver?

Issue

I'm looking for guides/videos, advice, and tips on how I can take the dataframe/json data from python and just deploy it on a simple table via html/php on my raspberry-pi which is running as a webserver on my local network. Any help would be greatly appreciated as I've been trying to do this for hours.


Solution

I don't have any experience with apache but getting your dataframe to display as a webpage is very simple using the df.to_html() method.

with open("dataframe.html", "w+") as f:
    html = df.to_html()
    f.write(html)

Now if you open dataframe.html locally you'll see your dataframe in the browser.

How you deploy that is another story -- it looks like python needs to be enabled. This link should get you started...



Answered By - Teejay Bruno