I have a csv file which i load to a database table using python and use pandas for transformations.
The file has repetitive headers after every certain number of rows as shown
ProductID Title Date Volume SalesAmount
123 Face wash 6-17-2019 7 35
124 Cleanser 6-17-2019 6 40
125 Hair Spray 6-17-2019 3 33
ProductID Title Date Volume SalesAmount
126 Hair Gel 6-17-2019 5 20
127 Shampoo 6-17-2019 4 24
128 Nail Varnish 6-17-2019 0 0
ProductID Title Date Volume SalesAmount
129 Nail Color 6-17-2019 9 18
130 Moisturizer 6-17-2019 3 27
And im desired output is one single header at top
ProductID Title Date Volume SalesAmount
123 Face wash 6-17-2019 7 35
124 Cleanser 6-17-2019 6 40
125 Hair Spray 6-17-2019 3 33
126 Hair Gel 6-17-2019 5 20
127 Shampoo 6-17-2019 4 24
128 Nail Varnish 6-17-2019 0 0
129 Nail Color 6-17-2019 9 18
130 Moisturizer 6-17-2019 3 27
I'm able to achieve it by index, by excluding the rows in pandas dataframe, but i want to know how to achieve the same using string comparison/regex in pandas or any better way of doing it.
df = df[df['ProductID'].ne('ProductID')]?