Jun-30-2020, 03:42 PM
import pandas as pd df = pd.read_excel('C:\\work\\\\Report1.xlsx', sheet_name = 'data1', nrows=6) df2 = pd.read_excel('C:\\work\\Report1.xlsx', sheet_name = 'data1', header=7) df2 = df2[df2["Data"].str.contains("Down*", na=False)]Hello,
The above code reads in df first 6 rows. df2 reads in the same file but starting at row 7. df2 then looks at row "Data", and finds anything with the word "Down" in it.
I end up with the variables
df DataFrame (6,14)
df2 DataFrame (25543,14)
I want to take df, and df2 and bring them back together to create df3. I want the first 6 rows of df to be at the top, and then df2 begins right at row 7. When I concatenate I end up with 28 columns instead of 14, and df2 header ends up at the top of the file instead of starting at row 7.