I have a data frame df like this
A B C D E F G H
a.1 b.1
c.1 d.1
c.2 d.2 e.1 f.1
g.1 h.1
Create the sample DataFrame
from io import StringIO
s = """A,B,C,D,E,F,G,H
a.1,b.1,,,,,,
,,c.1,d.1,,,,
,,c.2,d.2,e.1,f.1,,
,,,,,,g.1,h.1"""
df = pd.read_csv(StringIO(s))
I want to remove these extra spaces and I want dataframe to start from the top row. Can anyone help.
my desired results would be
A B C D E F G H
a.1 b.1 c.1 d.1 e.1 f.1 g.1 h.1
c.2 d.2