How to Efficiently Retrieve and Manipulate Large Dataset in Python?

15 views Asked by At

I'm currently working on a project that involves handling a large dataset in Python, and I'm facing some performance issues with my current implementation. I would appreciate some guidance on how to efficiently retrieve and manipulate this dataset to improve the overall performance of my program. Welkom {{ user }}

Jij bent een admin
Jouw dierenland heet Pleundieren

<br><br>
<table class="table">
    <thead>
    <tr>
        <th scope="col">Dier</th>
        <th scope="col">Beschrijving</th>
    </tr>

    </thead>
    <tbody>
    {% for dieren in dieren %}
        <tr>
            <td>{{ dieren.name }}</td>
            <td>{{ dieren.description }}</td>
            <td><button type="button" class="btn btn-danger">Verwijderen</button></td>
        </tr>
    {% endfor %}
    </tbody>
</table>
<a class="btn btn-success" href="{{ path('app_insert') }}" role="button">Toevoegen</a>

login

{% block body %}
    {% if error %}
        <div>{{ error.messageKey|trans(error.messageData, 'security') }}</div>
    {% endif %}

    <div class="container-md">

    <form action="{{ path('app_login') }}" method="post">
        <label for="username">Email:</label>
        <input type="text" id="username" name="_username" value="{{ last_username }}">

        <label for="password">Password:</label>
        <input type="password" id="password" name="_password">


    <input type="hidden" name="_target_path" value="/redirect">

        <button type="submit">login</button>
    </form>
    </div>
{% endblock %}
1

There are 1 answers

0
hipieskipie On
 {% for dieren in dieren %}
    <tr>
        <td>{{ dieren.name }}</td>
        <td>{{ dieren.description }}</td>
    </tr>
    {% endfor %}

`<?php

class AdminController extends AbstractController { #[Route('/admin', name: 'app_admin')] public function index(ManagerRegistry $doctrine): Response { $user = $this->getUser()->getFname(); $dieren=$doctrine->getRepository(Dier::class)->findAll(); return $this->render('admin/index.html.twig', [ 'user' => $user, 'dieren' => $dieren, ]); }

#[Route('/insert', name: 'app_insert')]
public function insert(Request $request, EntityManagerInterface $entityManager):Response{

    $dier= new Dier();
    $form=$this->createForm(DierType::class, $dier);

    $form->handleRequest($request);
    if ($form->isSubmitted() && $form->isValid()) {
        $entityManager->persist($dier);
        $entityManager->flush();

        return $this->redirectToRoute('app_admin');
    }
    return $this->renderForm('admin/insert.html.twig', [
        'form' => $form,
    ]);
}

}`