Importing existing data into Data Table

@adhamfaisal

I would suggest learning uplink as you will be able to use modules that are not available in the python 2 runtime.

The uplink tutorial is a good one. In the IDE, click the :gear: icon and then “uplink” and follow the instructions.

Perhaps try to modify the app I sent previously (change the runtime to python 2 and remove/ignore the “click to upload” button). Then, on your computer make a script with the following details:

import anvil.server
from tables import app_tables
import pandas as pd

anvil.server.connect("<paste in the uplink key you get from your app>")

df = pd.read_csv('beatles.csv') # or any CSV file with columns that match your DataTable
df = df.replace({pd.np.nan: None})
    
for d in df.to_dict(orient="records"):
    app_tables.beatles.add_row(**d)

Basically, you just want to move the server function that was using pandas to your local computer.

5 Likes