Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

drop row pandas

df.drop(index='Row Name', axis=1, inplace=True) 
Comment

remove rows from pandas

df = df[df["column_name"].isin([0, 1, 3, 4])]
# into isin we put the value we want to mantain
Comment

pandas drop rows

 current table:
  Modules	Subjects
0	DSM020	Data programming in Python
1	DSM030	Mathematics and statistics
2	DSM040	Machine learning
3	DSM010	Big data analysis
4	DSM050	Data visualisation
5	DSM060	Data science research topics
6	DSM070	Blockchain programming
7	DSM080	Mathematics of financial markets
8	DSM110	R for data science
9	DSM120	Financial data modelling
10	DSM500	Final project
11	DSM100	Artificial 

#dropping rows using indexes
list_of_subjects.drop([2,5,6,8,10,11])

output:
	Modules	Subjects
0	DSM020	Data programming in Python
1	DSM030	Mathematics and statistics
3	DSM010	Big data analysis
4	DSM050	Data visualisation
7	DSM080	Mathematics of financial markets
9	DSM120	Financial data modelling
Comment

PREVIOUS NEXT
Code Example
Python :: generate sha1 python 
Python :: python beautifulsoup get content of tag 
Python :: pandas add two string columns 
Python :: charcodeat python 
Python :: how to sort dictionary in python by lambda 
Python :: replace nat with date pandas 
Python :: python more order of columns 
Python :: public in python 
Python :: python download for ubuntu 20.04 
Python :: create virtual env 
Python :: start virtualenv 
Python :: python import multiple csv 
Python :: python list iterate in 1 line 
Python :: read json from api python 
Python :: minimum of two columns in pandas 
Python :: set pixel pygame 
Python :: python obtain data from pandas dataframe without index name 
Python :: prevent list index out of range python 
Python :: python index list enumerate 
Python :: django form set min and max value 
Python :: remove all integers from list python 
Python :: how to check if string is camelcase python 
Python :: remove duplicates python 
Python :: read file from s3 python 
Python :: reverse text python 
Python :: python string match ignore case 
Python :: AttributeError: __enter__ python 
Python :: convert data type object to string python 
Python :: docx change font python 
Python :: Scaling Operation in SkLearn 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =