1

-EDIT-

As Daniel Kasatchkow (below) suggested, I have attempted the following:

df._links.str.findall('qwer://abc\\\.x-data\\\.orc/v1/i/\d+/users')

But I get the following output:

0    NaN
1    NaN
2    NaN
3    NaN
4    NaN
5    NaN
...

UPDATE - Still unable to find a solution

4
  • is it link_re or regex_l ? Commented Dec 15, 2016 at 22:23
  • Your regex pattern will need to escape the \ and . characters. Also, generally you will need to capture your match with parentheses. Commented Dec 15, 2016 at 22:28
  • @moogle Alright. I don't believe that resolves the looping issue. Commented Dec 15, 2016 at 23:11
  • 1
    @BenF97 Well, it looks like you're trying to regex a dictionary, so instead you'll need to navigate down so that you're regexing a string 'qwer://...' Commented Dec 15, 2016 at 23:23

1 Answer 1

1

Try something like this

import pandas as pd

df = pd.DataFrame(["{u'users': {u'href': u'qwer://abc\.x-data\.orc/v1/i/32/users'}, u'self': {u'href': ...","{u'users': {u'href': u'qwer://abc\.x-data\.orc/v1/i/87/users'}, u'self': {u'href': ..."], columns=['_links'])

df._links.str.findall('qwer://abc\\\.x-data\\\.orc/v1/i/\d+/users')

When using regex I find it helpful to trial out the regex on http://pythex.org/

If the data is in a dictionary format, it would be best to convert it over to a DataFrame using pandas.DataFrame.from_dict

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.

Ask question

Explore related questions

See similar questions with these tags.