0

I have a database.csv where I store my data and I would like to generate a table from it and show it on my html page. I tried to use pandas but getting the following error

"AttributeError: type object 'DataFrame' has no attribute 'from_csv'"

import pandas as pd

    @app.route("/table")
    def table():
        table = pd.DataFrame.from_csv("db/database.csv")
        return render_template("table.html", data=data)

I dont think it worth to show my html jinja content as I fails on this function. Could someone help how to achieve this?

davidism
  • 121,510
  • 29
  • 395
  • 339
user3916
  • 121
  • 2
  • 4
  • 11

1 Answers1

0

To read a CSV file use import pandas as pd dataframe=pd.read_csv('data.csv')

This returns a pandas dataframe

DevHyperCoder
  • 895
  • 1
  • 9
  • 22