I am complete beginner in Python. I've imported a CSV file into Python. It is 1618 rows x 1 columns. Essentially, I want to keep 2 recurring rows of data throughout the data frame. I would like to do this by deleting all rows that do not contain the following text:
1) starts with a space and 9 following digits at the beginning of the row (Ex: "123456789")
2) has a row that contains any of the following digits ("2000", "2001", ..., "2020")
So basically, I would be left with two types of rows however amount of times they appear in the data frame:
1) With a space and 9 digits following
2) with any row containing "2000", all the way up to "2020"
Any help writing this would be amazing and greatly appreciated. I am looking to learn more and be able to do all of this independently.
UPDATE: Hey thank you all for the help... I will provide some lines that print from the CSV for clarification:
11 XXXXXX ...
12 NAME: ABC
13 ----------------------------------------------...
14 XXX...
15 123456789 - - .0000 ...
16 -------------------------------------...
17 G52 0000000000000000000000...
18 G53 XXX 09132017 ...
NOTE: Please disregard the strange lines with X's and dashes... the data comes from another program. Line 18 contains the date which would be found by the year "2017", and line 15 contains the beginning space and 9 digits. If any more information would help, feel free to let me know. Thank you!