I am trying to filter out rows (int in a yearmonth format) from a .csv file. For example trying to drop all rows that contain 202301. It seems no matter how I use the drop() method I am getting the error 'not found in axis'.
The dates are under a header called "Activity Period". There are about 500 rows that I have confirmed have this date but I cannot for the life of me get this drop method to work. The datatype for this column is int, even though stack overflow keeps recommending methods for filtering str.
From beginning:
data = pd.read_csv("Air_Traffic_Passenger_Statistics.csv")
cln_columns = data.drop(columns = ["Published Airline", "Published Airline IATA Code", "data_as_of", "data_loaded_at"], axis = 'columns')
This worked successfully to remove unnecessary columns, then I'm trying to do:
cln_rows = cln_columns.drop('202301')
KeyError: "['202301'] not found in axis"
These are not indexed rows, there are several hundred rows that contain this number, so how do I filter out the rows that contain that number?
Forgive me as I'm still very new to python and pandas in general. Thank you!