0

I'm having a file containing a row having actually many columns separated by space, but panda is reading them as one column.

For more detail I've attached here the part of the file. Any type of suggetion/discussion will be welcomed. TIA -Shruti

I've tried to separate them using str.split() & str.extract(), but didn't work. I want to split (so called single) column into multiple columns containg a data separated by space in (single) previous column.

INPUT FILE: enter image description here

| Column A      | Column B |
| --------------| -------- |
|1 1 1 1 1 1 1 1|          |
|1 1 1 1 1 1 1 1|          |

EXPECTED : enter image description here

| Column A | Column B |Column C |.......
| ---------| -------- | --------|
|    1     |    1     |    1    |.......
|    1     |    1     |    1    |.......
Amadan
  • 191,408
  • 23
  • 240
  • 301
  • [`pandas.Series.str.split`](https://pandas.pydata.org/docs/reference/api/pandas.Series.str.split.html) with `expand=True` – Amadan Mar 24 '23 at 07:19
  • Does this answer your question? [How to split a dataframe string column into two columns?](https://stackoverflow.com/questions/14745022/how-to-split-a-dataframe-string-column-into-two-columns) – Amadan Mar 24 '23 at 07:20

0 Answers0