I have a column DATA that contains lists of lists. See an example [[1250, 4551, 2255,…
Jump to turn (7)
- 1I have a column DATA that contains lists of lists. See an example [[1250, 4551,
- 2I need to split the newcolumn following the next rules: If the second part of 12
- 3No, look at the following example newcolumn = [[12504551, 45512255, 22554566, 22
- 4This code splitted by one digit not four digits
- 5It does not check whether the last four digits and the first four digits of cons
- 6It does not work. If I enter the following row [48144814, 60114814, 48146011, 60
- 7Good, modify the code if numbers are 12 digits. Compare the last 4 digits with t
- User
I have a column DATA that contains lists of lists. See an example [[1250, 4551, 2255, 4566], [7895, 1456, 4562], [1234, 5789, 5456, 1245, 1258]]
Write Python code to get new column where 1 and 2 element are merged, 2 and 3 are merged. So I need [[12504551, 4551255, 22554566], [78951456, 14564562], [12345789, 57895456, 54561245, 12451258]]
- Assistant
You can use a list comprehension to iterate over each inner list in the DATA column, merge the elements as described, and store the result in a new column.
Here's the Python code to achieve this:
python