Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Python Tutorial: Review of pandas DataFrames

Автор: DataCamp

Загружено: 2020-04-03

Просмотров: 1109

Описание:

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

---
Let's learn how to get data in and look at it.

We'll need to remember a few things about Pandas first.

Pandas is a library for data analysis.

The powertool of Pandas is the DataFrame, a tabular data structure with labeled rows & columns.

As an example, we'll use a DataFrame with Apple stock data.

The rows are labeled by a special data structure called an Index (we'll learn more about Indexes later).

Indexes in Pandas are tailored lists of labels that permit fast look-up and some powerful relational operations.

The index labels in the aapl DataFrame are dates in reverse chronological order.

Labeled rows & columns improves the clarity and intuition of many data analysis tasks.

When we ask for the type of the object AAPL, it's a DataFrame.

When we ask for its shape, it has 8514 rows & 6 columns.

The DataFrame columns attribute gives the names of its columns (Open, High, Low, Close, Volume, and Adjusted Close).

Notice the aapl.columns are also a Pandas Index.

Actually, the aapl.index attribute in this case is a special kind of Index called a DatetimeIndex.

We'll study DatetimeIndexes and time series later.

DataFrames can be sliced like NumPy arrays or Python lists using colons to specify the start, end, and stride of a slice.

First, we can slice from the start of the DataFrame to the 5th row (non-inclusive) using the dot iloc accessor to express the slice positionally.

Second, we can slice from the 5th last row to the end of the DataFrame using a negative index.

Remember, it's also possible to slice using labels with the dot loc accessor.

There's another way to see just the top rows of a DataFrame: the head method.

Specifying head(5) returns the first 5 rows.

Specifying head(2) returns the first 2 rows.

The head() method is particularly useful here because our DataFrame has over 8000 rows.

The opposite of head() is tail().

Specifying tail() without an argument returns the last 5 rows by default.

Specifying tail(3) returns the last 3 rows.

Again, tail() gives a useful summary of a large DataFrames.

Another useful summary method is info.

info returns other useful summary information, including the kind of Index, the column labels, the number of rows & columns, and the datatype of each column.

Pandas DataFrame slices also support broadcasting (we'll learn more about this later).

Here, a slice is assigned a scalar value (in this case, nan or Not a Number).

The slice consists of every third row starting from zero in the last column.

We can call head(6) to see the changes.

We can also call info() and notice the last column has fewer non-null entries than the others due to our assigning nan to every third element.

The columns of a DataFrame are themselves a specialized Pandas structure called a Series.

Extracting a single column from a DataFrame returns a Series.

Notice the Series extracted has its own head() method and inherits its name attribute from the DataFrame column.

To extract the numerical entries from the Series, use the values attribute.

The data in the Series actually form a NumPy array which is what the values attribute yields.

A Pandas Series, then, is a 1D labelled NumPy array and a DataFrame is a 2D labelled array whose columns are Series.

We've seen a few concepts extending what we already knew about including head, tail, info, index, values, and Series.

Take some time to practice using these concepts in the exercises.

#Python #PythonTutorial #DataCamp #pandas #Foundations #DataFrames

Python Tutorial: Review of pandas DataFrames

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Исследовательский анализ данных с помощью Pandas Python

Исследовательский анализ данных с помощью Pandas Python

Декораторы Python — наглядное объяснение

Декораторы Python — наглядное объяснение

NumPy vs Pandas

NumPy vs Pandas

What is Pandas? Why and How to Use Pandas in Python

What is Pandas? Why and How to Use Pandas in Python

Excel против Power BI против SQL против Python | Сравнение на фондовом рынке

Excel против Power BI против SQL против Python | Сравнение на фондовом рынке

Как быстро освоить Python для инженеров данных (пошаговое руководство 2026 года)

Как быстро освоить Python для инженеров данных (пошаговое руководство 2026 года)

Analyzing Stock Price Correlations in Python

Analyzing Stock Price Correlations in Python

Изучите SQL за 5 минут! (А вы сможете?)

Изучите SQL за 5 минут! (А вы сможете?)

Эта ФУНКЦИЯ спасла мой вечер от СКУЧНОЙ РАБОТЫ в Excel! ОНА нужна всем!

Эта ФУНКЦИЯ спасла мой вечер от СКУЧНОЙ РАБОТЫ в Excel! ОНА нужна всем!

Python — полный курс для начинающих. Этот навык изменит твою жизнь.

Python — полный курс для начинающих. Этот навык изменит твою жизнь.

Filtering Columns and Rows in Pandas | Python Pandas Tutorials

Filtering Columns and Rows in Pandas | Python Pandas Tutorials

Изучите Python за 5 минут

Изучите Python за 5 минут

Задача из вступительных Стэнфорда

Задача из вступительных Стэнфорда

Срочные переговоры с Путиным / Вывод части войск

Срочные переговоры с Путиным / Вывод части войск

Что такое квантовая теория

Что такое квантовая теория

Учебное пособие по R — Использование фрейма данных в R

Учебное пособие по R — Использование фрейма данных в R

Делаю нейросеть с нуля

Делаю нейросеть с нуля

25 привычек новичка в Python, от которых стоит избавиться

25 привычек новичка в Python, от которых стоит избавиться

Перестаньте использовать длинные формулы: попробуйте вместо них «*» и «?»

Перестаньте использовать длинные формулы: попробуйте вместо них «*» и «?»

Seaborn Is The Easier Matplotlib

Seaborn Is The Easier Matplotlib

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com