Driving Question
I have a text file with textual descriptions and numeric summaries of sales records. I need to extract portions of this data containing sales records and present the information sorted for easy viewing and interpretation.
My goal is to write code to read the text file and print out the 5 top-selling notable products, in descending order of sales. The expected output for the given file should look as follows:
1. Phone
2. Tablet
3. RGB Coffee Mug
4. PC
5. Webcam
In today’s tutorial, we will tackle another beginner-level task working with text files. We will apply some basic python string functions to both clean and structure the input data for subsequent analysis. In addition, we will make good use of python list comprehensions to deal with looping over the data.
What we’ll cover today:
0:00 Introduction
2:50 Read in the text file
4:20 Parse and clean the data
8:37 Extract data needed for further steps
12:27 Sort the data
18:17 Format data for output
*Additional References*:
This tutorial assumes a basic understanding of Python strings. Also, some basic understanding of reading and writing files will be sufficient.
Source Code
Visit the following GitHub repository to follow along with the code used in this tutorial
https://github.com/quizem/data-skills...
In questa pagina del sito puoi guardare il video online #9 Basic Python Data Extraction from Text Files della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Data Skills for Everyone 11 novembre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 16,005 volte e gli è piaciuto 131 spettatori. Buona visione!