Skip to content
Advertisement

Creating another column in pandas based on a pre-existing column

I have a third column in my data frame where I want to be able to create a fourth column that looks almost the same, except it has no double quotes and there is a ‘user/’ prefix before each ID in the list. Also, sometimes it is just a single ID vs. list of IDs (as shown in example DF).

original

JavaScript

desired

JavaScript

Advertisement

Answer

Given:

JavaScript

Doing:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement