Тёмный
No video :(

How to Remove a Column From a Data Frame in Pandas (Python) 

DataDaft
Подписаться 47 тыс.
Просмотров 4,6 тыс.
50% 1

This video shows 3 ways to remove columns from Data Frames in the Pandas library for Python.
If you find this video useful, like, share and subscribe to support the channel!
► Subscribe: www.youtube.co...
Code used in this Python Code Clip:
import pandas as pd
import statsmodels.api as sm #(To access mtcars dataset)
mtcars = sm.datasets.get_rdataset("mtcars", "datasets", cache=True).data
mtcars.head()
Delete by column by name
del mtcars["cyl"]
mtcars.head()
Delete columns by name with df.drop()
mtcars = mtcars.drop(["hp", "carb"], # Cols to drop
axis = 1) # 1 for columns
mtcars.head()
Delete columns by index position with df.drop()
mtcars = mtcars.drop(mtcars.columns[[1,3]], # Index of cols to drop
axis = 1) # 1 for columns
mtcars.head()
* Note: RU-vid does not allow greater than or less than symbols in the text description, so the code above will not be exactly the same as the code shown in the video! I will use Unicode large < and > symbols in place of the standard sized ones. .
⭐ Kite is a free AI-powered coding assistant that integrates with popular editors and IDEs to give you smart code completions and docs while you’re typing. It is a cool application of machine learning that can also help you code faster! Check it out here: www.kite.com/g...

Опубликовано:

 

1 сен 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 3   
@adamshenk9970
@adamshenk9970 4 месяца назад
As always super helpful videos - I love the short format
@didierleprince6106
@didierleprince6106 4 года назад
Merci (:
@yousraali3958
@yousraali3958 11 месяцев назад
thanks
Далее
Будзек и рецепт🐝
00:25
Просмотров 96 тыс.
Merging DataFrames in Pandas | Python Pandas Tutorials
22:09
Python for Data Analysis: Pandas Data Frames
22:59
Просмотров 25 тыс.
Data Cleaning in Pandas | Python Pandas Tutorials
38:37