Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

drop colums whoose value are object type in python

import pandas as pd

df = pd.DataFrame({'x': ['a', 'b', 'c'], 'y': [1, 2, 3], 'z': ['d', 'e', 'f']})

df = df.select_dtypes(exclude=['object'])
print(df)
Comment

PREVIOUS NEXT
Code Example
Python :: Active Voice Python 
Python :: print in python without using print or sys module 
Python :: Creating a donut plot python 
Python :: dataframe select columns based on list 
Python :: python string format 
Python :: zip python 
Python :: power function python 
Python :: python array scalar multiplication 
Python :: remove zeros from decimal python 
Python :: pandas print tabulate no index 
Python :: print from within funciton with multiprocessing 
Python :: how to create a set from a list in python 
Python :: converting numpy array to dataframe 
Python :: decimal to octal in python 
Python :: py foreach 
Python :: make legend box transparent in matplotlib 
Python :: how to get key value in nested dictionary python 
Python :: python get substring between strings 
Python :: closing a file in python 
Python :: pandas melt() function, change the DataFrame format from wide to long 
Python :: zip multiple lists 
Python :: python index of string 
Python :: how to change data type from int to float in dataframe 
Python :: print random integers py 
Python :: How to check if a given string is a palindrome, in Python? 
Python :: python how to see what pip packages are installed 
Python :: python if 
Python :: how to select rows with specific values in pandas 
Python :: django get query parameters 
Python :: math domain error python 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =