Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Filtering Large Datasets | Working with Large Datasets
Large Data Handling
Abschnitt 1. Kapitel 5
single

single

Challenge: Filtering Large Datasets

Swipe um das Menü anzuzeigen

Imagine you are tasked with analyzing a massive CSV file containing millions of records—too large to load into memory all at once. Your goal is to extract only those rows where a specific column's value exceeds a given threshold, saving the filtered results to a new file. This scenario is common in large-scale data analysis, where efficient, memory-friendly processing is essential.

Aufgabe

Wischen, um mit dem Codieren zu beginnen

Implement a function that processes a large CSV file in chunks and writes only the rows where the specified column's value is greater than the given threshold to a new file.

  • Read the input CSV file in chunks of size chunk_size.
  • For each chunk, filter rows where the column specified by column is greater than threshold.
  • Write all filtered rows to the output CSV file, including the header row.
  • If no rows match the condition, write only the header to the output file.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 5
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

some-alt