I have pandas dataframe type in one column with string type like this:
commits
0 12, 12, 9, 71, 145, 326, 315
1 54, 23, 265, 160, 164, 142
2 1, 335
3 6, 3, 21, 873
...
The data's type is below:
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 238089 entries, 0 to 238088
Data columns (total 1 columns):
commits 238089 non-null object
dtypes: object(1)
memory usage: 1.8+ MB
I would like to spilt it into separate column with integer type like this:
0 1 2 3 4 5 6
0 12 12 9 71 145 326 315
1 54 23 265 160 164 142
2 1 335
3 6 3 21 873
...
That is to say, each number is an integer now. The sequence of each row sholud not be changed.
In the original dataset, each row has a different length of numbers. Is it possible that the spilt one also can keep different row length? That is to say, no Nan or None value occupies the empty place.
If it is not possible to spilt without None or Nan, what is the easiest way to program?
The new dataset can be numpy or dataframe type.
How to code this in python? Thanks.