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 :: savefig resolution 
Python :: not scientific notation python 
Python :: python get files in directory 
Python :: python replace letters in string 
Python :: Entry border color in tkinter 
Python :: scikit learn svm 
Python :: pandas groupby count occurrences 
Python :: python set symmetric difference 
Python :: how to play mp3 audio in python 
Python :: 13 digit timestamp python 
Python :: python link to jpg 
Python :: python dividing strings by amount of letters 
Python :: python find word in list 
Python :: how to print all rows in pandas 
Python :: python numpy arrays equal 
Python :: tkinter canvas remove 
Python :: exit all threads from within a thread python 
Python :: how to keep columns in pandas 
Python :: python - make a copy of a df 
Python :: get requests from python 
Python :: mount drive google colab 
Python :: parse list from string 
Python :: max of matrix numpy 
Python :: add background image in django uploaded file 
Python :: boxplot for all columns in python 
Python :: draw a circle in python turtle 
Python :: open mat python 
Python :: extract text regex python 
Python :: add element to list python at index 
Python :: how to detect an even number in python 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =