<>KeyError: “[‘total’] not found in axis”

<> Delete named Total Columns of

<> code :
crime.drop('total',inplace=True)
<> report errors :

<> analysis :

<>DataFrame.drop(labels=None,axis=0, index=None, columns=None, inplace=False)

Parameter description :

* labels Is the name of the row to be deleted , Given by list
* axis Default to 0, Delete line , Therefore delete columns To specify when axis=1;
* index Directly specify the row to delete
* columns Directly specify the column to delete
* inplace=False, By default, the deletion operation does not change the original data , Instead, it returns a new file after the deletion operation dataframe;
* inplace=True, The original data will be deleted directly , Cannot return after deletion .
therefore , There are two ways to delete rows and columns :

* 1)labels=None,axis=0 Combination of
* 2)index or columns Directly specify the row or column to delete
summary :

* Through analysis , It can be concluded that when writing code on it , What we want to delete is the column , But it was not specified axis=1, So when deleting , The default lookup is the row index .(
There is another small problem , When writing column names ,Total The first letter is not capitalized , Noteworthy !!!)

Technology