Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Given a list as follows:
['start year: 2019', 'end year: 2021']
How could I split them by : and convert into a dataframe?
:
start year end year 2019 2021
Thanks for your help at advance.
You can do
df = pd.DataFrame([x.split(':')for x in l ]).set_index(0).T 0 start year end year 1 2019 2021
Add a comment
0
2019 2021
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.