Add pedestrian streets dataset
This commit is contained in:
@@ -4,6 +4,7 @@ from wtforms import SelectField, SubmitField
|
||||
from wtforms.validators import DataRequired
|
||||
|
||||
|
||||
# NOTE The choices should be shorter
|
||||
class DatasetForm(FlaskForm):
|
||||
dataset = SelectField(validators=[DataRequired()], choices=DATASETS)
|
||||
submit = SubmitField("Submit")
|
||||
|
||||
@@ -3,6 +3,7 @@ from json import load
|
||||
from pandas import DataFrame, json_normalize
|
||||
|
||||
from constants import COLUMNS, FILES
|
||||
from app.data_request import request_dataset
|
||||
|
||||
|
||||
def open_json(dataset) -> dict:
|
||||
@@ -18,6 +19,7 @@ def create_dataframe(dataset) -> DataFrame:
|
||||
"""
|
||||
Creates a DataFrame from a JSON file
|
||||
"""
|
||||
request_dataset(dataset)
|
||||
json = open_json(dataset)
|
||||
df = json_normalize(data=json, record_path=["records"], errors="ignore",)
|
||||
filtered_df = df.filter(items=COLUMNS[dataset])
|
||||
|
||||
Reference in New Issue
Block a user