1

I have been trying to find a way to split a text data(separator is space) in a single column into multiple columns. i can do it by Pandas using the following code, but i would like to do the same with Vaex.

i was looking at the Vaex API document, but i can't see rsplit equivalent method to do so. https://vaex.readthedocs.io/en/latest/api.html

df_data = df_data.iloc[:,0].apply(lambda x: pd.Series(x.rsplit(" ")))

I have also referred this page who was asking similar question and tried to run the same code. but in my environment i get this Error evaluating: ValueError('No memory tracker found with name default').

vaex extract one column of str.split()

df = pd.DataFrame({'ticker' : ['spx 5/25/2001 p500', 'spx 5/25/2001 p600', 'spx 5/25/2001 p700']})
df_vaex = vaex.from_pandas(df)
df_vaex["ticker"].str.split(" ").apply(lambda x: x[-1])

enter image description here

mh0189
  • 21
  • 3

2 Answers2

1

Are you using the latest version of vaex?

I just tried out your code example and it works fine..

enter image description here

Joco
  • 803
  • 4
  • 7
0

After i restarted my laptop, following split method worked and i got a result as I expected.

df_data = df_data[:,0].str.split(' ').apply(lambda x: x[3])
mh0189
  • 21
  • 3