0

I am trying to remove "year" after an integer in a dataframe. How can I keep the integers but remove years? I tried the following:

df['Years in current job'] = lambda x: x.df['Years in current job'][0]

enter image description here

4
  • df['Years in current job].str[0] ? Commented Jul 14, 2020 at 23:41
  • Can you show some example data. Commented Jul 14, 2020 at 23:43
  • 1
    df['Years in current job].str.split().str[0] Commented Jul 14, 2020 at 23:45
  • But the dtype is object, so I can't use str Commented Jul 14, 2020 at 23:46

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.