Популярное

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

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

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

Топ запросов

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

Python Tutorial: Plot all of your data: ECDFs

Автор: DataCamp

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

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

Описание:

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

---
We saw in the last video the clarity of bee swarm plots.

However, there is a limit to their efficacy. For example, imagine we wanted to plot the county-level voting data for all states

east of the Mississippi River and all states west. We make the swarm plot as before, but using a DataFrame that contains all states, with each classified as being east or west of the Mississippi.

The bee swarm plot has a real problem. The edges have overlapping data points, which was necessary in order to fit all points onto the plot. We are now obfuscating data. So, using a bee swarm plot here is not the best option.

As an alternative,

we can compute an empirical cumulative distribution function, or ECDF. Again, this is best explained by example. Here is a picture of an ECDF of the percentage of swing state votes that went to Obama. A x-value of an ECDF is the quantity you are measuring, in this case the percent of vote that sent to Obama. The y-value is the fraction of data points that have a value smaller than the corresponding x-value.

For example, 20% of counties in swing states had 36% or less of its people vote for Obama.

Similarly, 75% of counties in swing states had 50% or less of its people vote for Obama.

Let's look at how to make one of these from our data. The x-axis is the sorted data. We need to generate it using the NumPy function sort, so we need to import Numpy, which we do using the alias np as is commonly done. The we can use np dot sort to generate our x-data. The y-axis is evenly spaced data points with a maximum of one, which we can generate using the np dot arange function and then dividing by the total number of data points. Once we specify the x and y values, we plot the points.

By default, plt-dot-plot plots lines connecting the data points. To plot our ECDF, we just want points. To achieve this we pass the string period and the string 'none' to the keywords arguments marker and linestyle, respectively.

As you remember from my forceful reminder in an earlier video, we label the axes. Finally, we use the plt dot margins function to make sure none of the data points run over the side of the plot area. Choosing a value of point-02 gives a 2% buffer all around the plot.

The result is the beautiful ECDF I just showed you. We can also easily plot multiple ECDFs on the same plot.

For example, here are the ECDFs for the three swing states. We see that Ohio and Pennsylvania were similar, with Pennsylvania having slightly more Democratic counties. Florida, on the other hand, had a greater fraction of heavily Republican counties.

In my workflow, I almost always plot the ECDF first. It shows all the data and gives a complete picture of how the data are distributed.

But don't take my word for how great ECDFs are. You can see for yourself in the exercises!

#PythonTutorial #DataCamp #Statistical #Thinking #Python

Python Tutorial: Plot all of your data: ECDFs

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

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

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

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

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

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

ECDF: альтернативный график гистограмм

ECDF: альтернативный график гистограмм

What, Why and How to use ECDF in Python

What, Why and How to use ECDF in Python

Как сжимаются изображения? [46 МБ ↘↘ 4,07 МБ] JPEG в деталях

Как сжимаются изображения? [46 МБ ↘↘ 4,07 МБ] JPEG в деталях

Программирование с использованием математики | Лямбда-исчисление

Программирование с использованием математики | Лямбда-исчисление

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

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

Курс Python с Абсолютного нуля! [12 часов из 80] Python курс - качественный старт для начинающих!

Курс Python с Абсолютного нуля! [12 часов из 80] Python курс - качественный старт для начинающих!

Алгоритмы и структуры данных ФУНДАМЕНТАЛЬНЫЙ КУРС от А до Я. Графы, деревья, хеш таблицы и тд

Алгоритмы и структуры данных ФУНДАМЕНТАЛЬНЫЙ КУРС от А до Я. Графы, деревья, хеш таблицы и тд

Твоя ПЕРВАЯ НЕЙРОСЕТЬ на Python с нуля! | За 10 минут :3

Твоя ПЕРВАЯ НЕЙРОСЕТЬ на Python с нуля! | За 10 минут :3

6.1 Empirical CDF

6.1 Empirical CDF

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

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

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

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

Краткое объяснение больших языковых моделей

Краткое объяснение больших языковых моделей

Что такое СПИН? спин 1/2 и 3/2

Что такое СПИН? спин 1/2 и 3/2

Все, что вам нужно знать о теории управления

Все, что вам нужно знать о теории управления

Теренс Тао о том, как Григорий Перельман решил гипотезу Пуанкаре | Лекс Фридман

Теренс Тао о том, как Григорий Перельман решил гипотезу Пуанкаре | Лекс Фридман

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

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

Основание Фибоначчи - Numberphile

Основание Фибоначчи - Numberphile

4 часа Шопена для обучения, концентрации и релаксации

4 часа Шопена для обучения, концентрации и релаксации

Моделирование Монте-Карло

Моделирование Монте-Карло

Python  - Полный Курс по Python [15 ЧАСОВ]

Python - Полный Курс по Python [15 ЧАСОВ]

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



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



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