You can either Drop the columns you do not need OR Select the ones you need
# Using DataFrame.drop
df.drop(df.columns[[1, 2]], axis=1, inplace=True)
# drop by Name
df1 = df1.drop(['B', 'C'], axis=1)
# Select the ones you want
df1 = df[['a','d']]
More Related Contents:
- how to calculation cost time [closed]
- How to add a new column to an existing DataFrame?
- String concatenation of two pandas columns
- pandas: filter rows of DataFrame with operator chaining
- Reshape wide to long in pandas
- How do I create test and train samples from one dataframe with pandas?
- Pandas – Slice large dataframe into chunks
- Find column name in pandas that matches an array
- How do convert a pandas dataframe to XML?
- Python Pandas max value in a group as a new column
- Sort a pandas dataframe series by month name
- Count frequency of values in pandas DataFrame column
- Strip / trim all strings of a dataframe
- Efficiently replace values from a column to another column Pandas DataFrame
- Copying MultiIndex dataframes with pd.read_clipboard?
- Joining pandas DataFrames by Column names
- pandas get the row-wise minimum value of two or more columns
- Set maximum value (upper bound) in pandas DataFrame
- Return multiple columns from pandas apply()
- Putting many python pandas dataframes to one excel worksheet
- Remove Unnamed columns in pandas dataframe [duplicate]
- How to slice a pandas DataFrame by position?
- Filling in date gaps in MultiIndex Pandas Dataframe
- Writing a Python Pandas DataFrame to Word document
- Find unique values in a Pandas dataframe, irrespective of row or column location
- Efficient way to add rows to dataframe
- Find names of top-n highest-value columns in each pandas dataframe row
- What values are valid in Pandas ‘Freq’ tags?
- How to convert DataFrame.append() to pandas.concat()?
- How to efficiently assign unique ID to individuals with multiple entries based on name in very large df