我有一个要上传到Jupyter的CSV文件,并且试图一次删除多个列。我以为“ DEL”命令是最好的,但是我无法使它正常工作。
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
% matplotlib inline
tmbd_movies = pd.read_csv('tmdb-movies.csv')
tmbd_movies.head()
del(tmbd_movies['imdb_id','homepage','tagline','keywords','overview'])
目标是删除以下列:
imdb_id','homepage','tagline','keywords','overview
答案 0 :(得分:1)
您想要这个:
tmbd_movies.drop(['imdb_id','homepage','tagline','keywords','overview'], 'columns', inplace=True)