1

I have a pandas dataframe in the form:

df

     0             1
1   1921         12900
2   163          2300
3   163          5200
4   1921.923     9880
5   1927         13900
6   945.923      20480
7   166.369      51900
8   1863         1407
9   1863         28477
10  19           3868
11  578.476      13840
12  599          2700
13  162.476      10460
14  162.476      14840

Both columns are objects and therefore can be accessed with the str methods in a pandas dataframe. If you look at the column 0 more closely, you would notice that some numbers were joined together, for example: 1921.923 I would like to make each number stand alone.

To demonstrate, I would like to explode the dataframe to have it in the form:

     0             1
1   1921         12900
2   163          2300
3   163          5200
4   1921         9880
5   923          9880
6   1927         13900
7   945          20480
8   923          20480
9   166          51900
10  369          51900
11  1863         1407
12  1863         28477
13  19           3868
14  578          13840
15  476          13840
16  599          2700
17  162          10460
18  476          10460
19  162          14840
20  162          14840
JA-pythonista
  • 1,225
  • 1
  • 21
  • 44

0 Answers0