RUVIDEO
Поделитесь видео 🙏

Python Tutorial: Introduction to flat files

Want to learn more? Take the full course at https://learn.datacamp.com/courses/streamlined-data-ingestion-with-pandas at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work.

---
Welcome to the course! I'm Amany Mahfouz, and I'll be your instructor. In this course, we'll focus on ingesting data, a fundamental step in any data science project -- after all, you can't analyze what you can't access. Along the way, you'll learn some techniques to clean messy data.

To do this, we'll use the Python library pandas. pandas was originally developed by Wes McKinney in 2008 for financial quantitative analysis, but today it has a large development community and is used in many disciplines. pandas makes it easy to load and manipulate data, and it integrates with loads of analysis and visualization libraries.

Central to pandas is the data frame.

Data frames are two-dimensional data structures.

This means they have columns, typically labeled with variable names and rows, which also have labels, known as an index in pandas. The default index is the row number, but you can specify a column as the index, and many types of data can be used.

While you can create data frames by hand, you'll usually want to load existing data. Pandas handles many data formats, but let's start with a basic one: flat files.

Flat files are simple, making them popular for storing and sharing data. They can be exported from database management systems and spreadsheet applications, and many online data portals provide flat file downloads.

In a flat file, data is stored as plain text, with no formatting like colors or bold type.

Each line in the file represents one row, with column values separated by a chosen character called a delimiter.

Usually, the delimiter is a comma, and such files are called CSVs, or comma-separated values, but other characters can be used.

A single pandas function loads all flat files, no matter the delimiter: read CSV.

Let's import some tax data published as a CSV by the Internal Revenue Service, the U.S. government's tax collection agency. This file has information about household composition and income by ZIP code, making it useful for social and economic analyses.

First, we import pandas as pd. "pd" is the conventional nickname for pandas.

Then, we pass the file path as a string to pd dot read CSV, and assign the resulting data frame to a variable -- "tax data" here.

Finally, we check the first few rows of the new data frame with tax data dot head.

But what if that file used a different delimiter, like a tab? Rather than have different functions for every possible delimiter, pandas lets you import any flat file with read CSV and its sep keyword argument.

Let's use a tab-separated version of the same tax file to see what this looks like.

Again, we import pandas as pd.

Then we pass the file path string to read CSV, but this time, we include another argument, sep. "Backslash t" represents a tab.

Last, we check out the data frame with the head method.

Now it's your turn to practice what you've learned. Good luck!

#Python #PythonTutorial #DataCamp #Streamlined #Data #Ingestion #pandas #flatfiles

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Tutorial: Introduction to flat files», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.