a-pandas-ex-fastloc


Namea-pandas-ex-fastloc JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/a_pandas_ex_fastloc
SummaryUp to 25 times faster than df.loc by combining np.select and numexpr.evaluate (works with utf-8)
upload_time2023-02-05 03:14:36
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords numexpr numpy loc iloc pandas series
VCS
bugtrack_url
requirements numexpr numpy pandas regex ujson
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Extremely fast by combining np.select and numexpr.evaluate (works with utf-8!)



### Here is a simple query:



[https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv](https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv)



```python

%timeit (df.PassengerId >800) | (df.PassengerId <60)

194 µs ± 586 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)

```



**When you're working with pandas, speed matters!.**



### Well, there are 2 tricks to tremendously increase the speed of Pandas



**(Here are 2 examples: in case you have never heard about them)**



#### 1) np.select



```python

b=df.PassengerId.__array__()

%timeit np.select([b>800, b<60], [True,True], False)

21.5 µs ± 44.5 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)

```



#### 2) numexpr.evaluate



```python

b=df.PassengerId.__array__()

%timeit [numexpr.evaluate('(b > 800)|(b < 60)')]

10.5 µs ± 25 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)

```



#### Combining both



Well, why not combining those two?  numexpr.evaluate to do the queries, and np.select to filter the queries (True/False)



The problem is that numexpr has many limitations:



[https://numexpr.readthedocs.io/projects/NumExpr3/en/latest/user_guide.html#supported-operators](https://numexpr.readthedocs.io/projects/NumExpr3/en/latest/user_guide.html#supported-operators)



If you are working with numbers, you probably won't miss a lot, 



but with strings, it is different: numexpr nor supports the utf-8 format neither regex.



I am a German teacher and work most of the time with DataFrames containing strings (mainly bilingual dictionaries)



anywhere from 500 to 10000000 rows. Unfortunately, it is not that easy converting German words 



 to ASCII strings due to the special characters (ö, ä ...)



I found a way to simplify the conversion either way, without losing the special characters:



```python

df.Name.s_str().s_to_ascii()

df.Nameuni.s_str().s_to_utf8()

```



But converting them all the time back and forth (to use **Series.str [only UTF-8]**) doesn't make any sense, 



because we are loosing all the speed gained from numexpr.evaluate/np.select.



Unfortunately, **Series.str** doesn't accept binary data. 



But since I use all methods of the Series.str class frequently and 



I also want the benefits of numexpr.evaluate/np.select, I changed 



almost all methods of Series.str to make them work with binary data.



**Don’t be afraid**:



It won’t overwrite **Series.str**, it just adds **s_str**(parenthesis when you want to access the methods!)



Some of the adapted methods are faster, some are slower (still faster than converting)



and some are really slow, and should not be used (casefold/wrap/normalize)



and few of them are not working yet [(encode/decode) → adaption probably senseless].



And of course, the new insanely fast methods:



```python

s_uniascii_contains # only for strings, pass strings as utf-8

s_uniascii_equal # only for strings, pass strings as utf-8

d_floc # replacement for df.loc / combine it with numexpr.evaluate 

get_compiled_regex_from_wordlist  # instead of searching [Maria, Carlos, ...], use this function to generate a binary Trie regex

```



Scroll down to see the execution speed of every method compared to **Series.str**



## How to use



```python

from a_pandas_ex_fastloc import pd_add_fastloc,get_byte_regex,get_compiled_regex_from_wordlist,convert_utf8_to_ascii

pd_add_fastloc()

import pandas as pd

df = pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv")

df['Nameuni'] = df.Name + 'ö' # get some utf-8 data with special characters

df['Nameuni2'] = df['Nameuni'].s_str().s_to_ascii()

dfbig = pd.concat([df.copy() for x in range(100)],ignore_index=True)

dfbigbig = pd.concat([df.copy() for x in range(1000)],ignore_index=True)

```



### # The highlights



#### s_uniascii_contains



```python

%timeit dfbigbig.loc[dfbigbig.Nameuni.str.contains('Harrisö')]

239 ms ± 1.62 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

%timeit dfbigbig.loc[dfbigbig.Nameuni2.s_str().s_uniascii_contains('Harrisö')]

14.7 ms ± 111 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

```



### s_uniascii_equal



```python

%timeit dfbigbig.loc[dfbigbig.Nameuni == 'Braund, Mr. Owen Harrisö']

29.3 ms ± 179 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

%timeit dfbigbig.loc[dfbigbig.Nameuni2.s_str().s_uniascii_equal('Braund, Mr. Owen Harrisö')]

3.89 ms ± 5.78 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

```



### s_to_utf8



```python

# Data can be converted easily to utf-8:

dfbigbig.loc[dfbigbig.Nameuni2.s_str().s_uniascii_contains('Harrisö')].Nameuni2.s_str().s_to_utf8()

Out[65]: 

0         Braund, Mr. Owen Harrisö

891       Braund, Mr. Owen Harrisö

1782      Braund, Mr. Owen Harrisö

2673      Braund, Mr. Owen Harrisö

3564      Braund, Mr. Owen Harrisö

                    ...           

Name: Nameuni2, Length: 1000, dtype: object

```



### d_floc



```python

# You can also use numbers, but you won't get a speedup for simple queries

%timeit -n 4 dfbigbig.d_floc([('(Age > 10)',True)]) 

%timeit -n 4 dfbigbig.loc[dfbigbig.Age > 10]

139 ms ± 562 µs per loop (mean ± std. dev. of 7 runs, 4 loops each)

140 ms ± 486 µs per loop (mean ± std. dev. of 7 runs, 4 loops each)

```



```python

# Once the query gets more sophisticated, things are different:

%timeit -n 4 dfbigbig.d_floc([('((Age*3221/3220 > (10*.432/.431)) & (PassengerId%10 ==0))',True)])

%timeit -n 4 dfbigbig.loc[(dfbigbig.Age*3221/3220 > 10*.432/.431) & (dfbigbig.PassengerId %10 ==0)]

23.4 ms ± 583 µs per loop (mean ± std. dev. of 7 runs, 4 loops each)

35.2 ms ± 342 µs per loop (mean ± std. dev. of 7 runs, 4 loops each)

```



```python

%timeit -n 4 dfbigbig.d_floc([('((Age*3221/3220 > (10*.432/.431)) & (PassengerId%10 ==0))',True),(f'contains(Nameuni2,{repr(convert_utf8_to_ascii("Harrisö"))})',True)], convertstr=False)

%timeit -n 4 dfbigbig.loc[((dfbigbig.Age*3221/3220 > 10*.432/.431) & (dfbigbig.PassengerId %10 ==0)) | dfbigbig.Nameuni.str.contains("Harrisö")]

39.8 ms ± 1.01 ms per loop (mean ± std. dev. of 7 runs, 4 loops each)

272 ms ± 1.12 ms per loop (mean ± std. dev. of 7 runs, 4 loops each)



# Different ways of doing the query, check out the numexpr documentation

%timeit -n 4 dfbigbig.d_floc([('((Age*3221/3220 > (10*.432/.431)) & (PassengerId%10 ==0))',True),(f'contains(Nameuni2,{repr(convert_utf8_to_ascii("Harrisö"))})',True)], convertstr=False)

%timeit -n 4 dfbigbig.d_floc([(f'((Age*3221/3220 > (10*.432/.431)) & (PassengerId%10 ==0)) | contains(Nameuni2,{repr(convert_utf8_to_ascii("Harrisö"))})',True)], convertstr=False)

```



```python

# How to negate results (operator ~)

%timeit -n 4 dfbigbig.d_floc([(f'((Age*3221/3220 > (10*.432/.431)) & (PassengerId%10 ==0)) | contains(Nameuni2,{repr(convert_utf8_to_ascii("Harrisö"))})',False)], convertstr=False, default=True)

%timeit -n 4 dfbigbig.loc[~(((dfbigbig.Age*3221/3220 > 10*.432/.431) & (dfbigbig.PassengerId %10 ==0)) | dfbigbig.Nameuni.str.contains("Harrisö"))]

194 ms ± 1.55 ms per loop (mean ± std. dev. of 7 runs, 4 loops each)

436 ms ± 3.34 ms per loop (mean ± std. dev. of 7 runs, 4 loops each)

```



```python

# without converting the Series with utf-8 strings to ASCII

queries=[('contains(Name, "Maria")',True)]

# convertstr=True -> Converts utf-8 to bytes, must be True if the column is not ASCII, and False if ASCII 

%timeit df.d_floc(queries, default=False, convertstr=True) 

%timeit df.loc[df.Name.str.contains('Maria')]



# Even though, the Series has been converted to bytes in every loop, fastloc is still much faster:

329 µs ± 4.25 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

491 µs ± 2.14 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

```



```python

# How to convert

df['Name2'] = df.Name.s_str().s_to_ascii()

# works also with special characters (ö, ï ...)

df['Nameuni2'] = df.Nameuni.s_str().s_to_ascii()

```



```python

# Faster when converted (convertstr=False)

queries=[('contains(Name2, "Maria")',True)]

%timeit df.d_floc(queries, default=False, convertstr=False) 

%timeit df.loc[df.Name.str.contains('Maria')]

270 µs ± 1.29 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

510 µs ± 1.15 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

```



```python

# You can also use: 

%timeit df.loc[df.Name2.s_str().s_uniascii_contains('Maria')]



# The bigger the dataframe, the better:

dfbig['Nameuni2'] = dfbig.Nameuni.s_str().s_to_ascii()

dfbig['Name2'] = dfbig.Name.s_str().s_to_ascii()

queries=[('contains(Name2, "Maria")',True)]

%timeit dfbig.d_floc(queries, default=False, convertstr=False) 

%timeit dfbig.loc[dfbig.Name.str.contains('Maria')]

2.04 ms ± 206 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

25.6 ms ± 90.1 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)





dfbigbig['Nameuni2'] = dfbigbig.Nameuni.s_str().s_to_ascii()

dfbigbig['Name2'] = dfbigbig.Name.s_str().s_to_ascii()

queries=[('contains(Name2, "Maria")',True)]

%timeit dfbigbig.d_floc(queries, default=False, convertstr=False) 

%timeit dfbigbig.loc[dfbigbig.Name.str.contains('Maria')]

18.3 ms ± 347 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

251 ms ± 392 µs per loop (mean ± std. dev. of 7 runs, 1 loop each)

```



```python

# Converting the results to unicode:

dfbigbig.d_floc(queries, default=False, convertstr=False).Nameuni2 .s_str().s_to_utf8()

Out[42]: 

18        Vander Planke, Mrs. Julius (Emelia Maria Vande...

38                      Vander Planke, Miss. Augusta Mariaö

85        Backstrom, Mrs. Karl Alfred (Maria Mathilda Gu...

119                      Andersson, Miss. Ellis Anna Mariaö

307       Penasco y Castellana, Mrs. Victor de Satode (M...

                                ...                        

890535         Clarke, Mrs. Charles V (Ada Maria Winfield)ö

890687                    Caram, Mrs. Joseph (Maria Elias)ö

890690    Thayer, Mrs. John Borland (Marian Longstreth M...

890747              Panula, Mrs. Juha (Maria Emilia Ojala)ö

890925                        Heininen, Miss. Wendla Mariaö

Name: Nameuni2, Length: 12000, dtype: object

```



### convert_utf8_to_ascii



```python

# Searching for Unicode using numexpr directly

# Use this to convert the string to bin: {repr(convert_utf8_to_ascii("Harrisö"))}

queriesuni=[(f'contains(Nameuni2, {repr(convert_utf8_to_ascii("Harrisö"))})',True)]

%timeit df.d_floc(queriesuni, default=False, convertstr=False) 



293 µs ± 974 ns per loop (mean ± std. dev. of 7 runs, 1,000 loops each)





Out[11]: 

   PassengerId  ...                           Nameuni2

0            1  ...  b'Braund, Mr. Owen Harris\\u00f6'

[1 rows x 15 columns]



# Convert to utf-8

df.d_floc(queriesuni, default=False, convertstr=False).Nameuni2.s_str().s_to_utf8()

Out[17]: 

0    Braund, Mr. Owen Harrisö

Name: Nameuni2, dtype: object



#################################################################

%timeit df.loc[df.Nameuni.str.contains('Harrisö')]

514 µs ± 2.82 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

Out[13]: 

   PassengerId  ...                           Nameuni2

0            1  ...  b'Braund, Mr. Owen Harris\\u00f6'

[1 rows x 15 columns]

```



### get_byte_regex



```python

# Regex works too, but be careful with special characters



# Avoid this because you might get other results than you want:

comp0 = get_byte_regex('^.*?[öä]$')

print(comp0)

re.compile(b'^.*?[\\\\u00f6\\\\u00e4]$')



# Better

comp1=get_byte_regex('^.*?(?:(?:ö)|(?:ä))$')

print(comp1)

re.compile(b'^.*?(?:(?:\\\\u00f6)|(?:\\\\u00e4))$')



%timeit df.Nameuni2.s_str().findall(comp1)

%timeit df.Nameuni.str.findall('^.*?(?:(?:ö)|(?:ä))$')



# Not much faster, but at least a little

633 µs ± 1.35 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

641 µs ± 906 ns per loop (mean ± std. dev. of 7 runs, 1,000 loops each)



Out[21]: 

0                    [b'Braund, Mr. Owen Harris\\u00f6']

1      [b'Cumings, Mrs. John Bradley (Florence Briggs...

2                     [b'Heikkinen, Miss. Laina\\u00f6']

3      [b'Futrelle, Mrs. Jacques Heath (Lily May Peel...

4                   [b'Allen, Mr. William Henry\\u00f6']

                             ...                        

886                    [b'Montvila, Rev. Juozas\\u00f6']

887             [b'Graham, Miss. Margaret Edith\\u00f6']

888    [b'Johnston, Miss. Catherine Helen \\"Carrie\\...

889                    [b'Behr, Mr. Karl Howell\\u00f6']

890                      [b'Dooley, Mr. Patrick\\u00f6']

Name: Nameuni2, Length: 891, dtype: object



Out[22]: 

0                             [Braund, Mr. Owen Harrisö]

1      [Cumings, Mrs. John Bradley (Florence Briggs T...

2                              [Heikkinen, Miss. Lainaö]

3        [Futrelle, Mrs. Jacques Heath (Lily May Peel)ö]

4                            [Allen, Mr. William Henryö]

                             ...                        

886                             [Montvila, Rev. Juozasö]

887                      [Graham, Miss. Margaret Edithö]

888          [Johnston, Miss. Catherine Helen "Carrie"ö]

889                             [Behr, Mr. Karl Howellö]

890                               [Dooley, Mr. Patrickö]

Name: Nameuni, Length: 891, dtype: object





# With big DataFrames

%timeit dfbigbig.Nameuni2.s_str().findall(comp1)

%timeit dfbigbig.Nameuni.str.findall('^.*?(?:(?:ö)|(?:ä))$')

556 ms ± 2.61 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

571 ms ± 2.52 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

#################################################################

# You can use all regex methods from a Series.str. 

# But usually no speedup when using regex (sometimes a little faster, sometimes a little slower)

regexpextractall='^.*?((?:ö)|(?:ä))$'

comp1=get_byte_regex(regexpextractall)

%timeit dfbig.Nameuni2.s_str().extractall(comp1)

%timeit dfbig.Nameuni.str.extractall(regexpextractall)

209 ms ± 2.65 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

206 ms ± 3.98 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)



regexpextractall='^.*?((?:ö)|(?:ä))$'

comp1=get_byte_regex(regexpextractall)

%timeit dfbig.Nameuni2.s_str().replace(comp1, b'XX',regex=True)

%timeit dfbig.Nameuni.str.replace(regexpextractall, 'XX',regex=True)

69.9 ms ± 747 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

71.5 ms ± 293 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)



#################################################################

```



### get_compiled_regex_from_wordlist



```python

# If you have a list of words, create a Trie regex:

# e.g. all names with starting with M

lotsofwords = ([o for o in set([re.sub(r'\W+','',x) for x in "\n".join(df.Name.unique().tolist()).split()]) if o.startswith('M')])

lotsofwordsre=get_compiled_regex_from_wordlist(

        wordlist=lotsofwords,

        boundary_right=True,

        boundary_left=True,

        capture=False,

        match_whole_line=False,

    flags=re.I

    )

%timeit df.loc[df.Name.apply(lambda x: True if [y for y in lotsofwords if y in x] else False)]

%timeit df.loc[df.Name2.s_str().contains(lotsofwordsre,regex=True)]

7.02 ms ± 47.1 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

914 µs ± 1.45 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)

#################################################################

```



## Methods faster than Series.str



```python

# To avoid converting back and forth all the time (ascii - utf-8)

# I adapted most of the methods from the Series.str class 

# to work with bytes 

# Some methods are faster, some are slower and some are really slow 

# (casefold/wrap/normalize)

# But surely better than converting all the time 



# Lets create a copy of the DF

df5=dfbig.copy()

df5['Name1'] = df5.Nameuni2.copy() 

```



```python

#################################################################

print(df5.Name2.s_str().capitalize())

print(df5.Name1.s_str().capitalize())

print(df5.Name.str.capitalize())

%timeit -n 5 df5.Name2.s_str().capitalize()

%timeit -n 5 df5.Name1.s_str().capitalize()

%timeit -n 5 df5.Name.str.capitalize()

13.8 ms ± 313 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

13.9 ms ± 153 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

20.5 ms ± 169 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

# Not part of Series.str, but similar to Series.str.contains

print(df5.Name2.s_str().s_uniascii_equal('Svensson, Mr. Johan'))

print(df5.Name1.s_str().s_uniascii_equal('Svensson, Mr. Johan'))

print(df5.loc[df5.Name == 'Svensson, Mr. Johan'])

%timeit -n 5 df5.Name2.s_str().s_uniascii_equal('Svensson, Mr. Johan')

%timeit -n 5 df5.Name1.s_str().s_uniascii_equal('Svensson, Mr. Johan')

%timeit -n 5 df5.loc[df5.Name == ('Svensson, Mr. Johan')]

350 µs ± 126 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

317 µs ± 27.4 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

3.13 ms ± 34.7 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

# Not part of Series.str, but similar to Series.str.contains

print(df5.Name2.s_str().s_uniascii_contains('a'))

print(df5.Name1.s_str().s_uniascii_contains('a'))

print(df5.Name.str.contains('a'))

%timeit -n 5 df5.Name2.s_str().s_uniascii_contains('a')

%timeit -n 5 df5.Name1.s_str().s_uniascii_contains('a')

%timeit -n 5 df5.Name.str.contains('a')

1.12 ms ± 73.1 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

1.07 ms ± 16.4 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

24.6 ms ± 506 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().isalnum())

print(df5.Name1.s_str().isalnum())

print(df5.Name.str.isalnum())

%timeit -n 5 df5.Name2.s_str().isalnum()

%timeit -n 5 df5.Name1.s_str().isalnum()

%timeit -n 5 df5.Name.str.isalnum()

9.67 ms ± 125 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

9.44 ms ± 74.2 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

10 ms ± 122 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().isalpha())

print(df5.Name1.s_str().isalpha())

print(df5.Name.str.isalpha())

%timeit -n 5 df5.Name2.s_str().isalpha()

%timeit -n 5 df5.Name1.s_str().isalpha()

%timeit -n 5 df5.Name.str.isalpha()

9.74 ms ± 164 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

9.45 ms ± 91.4 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

9.77 ms ± 44.4 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().istitle())

print(df5.Name1.s_str().istitle())

print(df5.Name.str.istitle())

%timeit -n 5 df5.Name2.s_str().istitle()

%timeit -n 5 df5.Name1.s_str().istitle()

%timeit -n 5 df5.Name.str.istitle()

14 ms ± 563 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

13.8 ms ± 83.5 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

17.5 ms ± 188 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().partition())

print(df5.Name1.s_str().partition())

print(df5.Name.str.partition())

%timeit -n 5 df5.Name2.s_str().partition()

%timeit -n 5 df5.Name1.s_str().partition()

%timeit -n 5 df5.Name.str.partition()

86.8 ms ± 817 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

86.8 ms ± 297 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

89.5 ms ± 412 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().rpartition())

print(df5.Name1.s_str().rpartition())

print(df5.Name.str.rpartition())

%timeit -n 5 df5.Name2.s_str().rpartition()

%timeit -n 5 df5.Name1.s_str().rpartition()

%timeit -n 5 df5.Name.str.rpartition()

89.1 ms ± 773 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

90.2 ms ± 490 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

90.5 ms ± 383 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().repeat(100))

print(df5.Name1.s_str().repeat(100))

print(df5.Name.str.repeat(100))

%timeit -n 5 df5.Name2.s_str().repeat(100)

%timeit -n 5 df5.Name1.s_str().repeat(100)

%timeit -n 5 df5.Name.str.repeat(100)

75.7 ms ± 4.08 ms per loop (mean ± std. dev. of 7 runs, 5 loops each)

92.6 ms ± 5.07 ms per loop (mean ± std. dev. of 7 runs, 5 loops each)

113 ms ± 387 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().slice_replace(start=1, stop=10, repl=b'2'))

print(df5.Name1.s_str().slice_replace(start=1, stop=10, repl=b'2'))

print(df5.Name.str.slice_replace(start=1, stop=10, repl='2'))

%timeit -n 5 df5.Name2.s_str().slice_replace(start=1, stop=10, repl=b'2')

%timeit -n 5 df5.Name1.s_str().slice_replace(start=1, stop=10, repl=b'2')

%timeit -n 5 df5.Name.str.slice_replace(start=1, stop=10, repl='2')

30.8 ms ± 544 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

31 ms ± 285 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

44.5 ms ± 281 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().split())

print(df5.Name1.s_str().split())

print(df5.Name.str.split())

%timeit -n 5 df5.Name2.s_str().split()

%timeit -n 5 df5.Name1.s_str().split()

%timeit -n 5 df5.Name.str.split()

39.1 ms ± 558 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

39.8 ms ± 280 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

40.1 ms ± 244 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().swapcase())

print(df5.Name1.s_str().swapcase())

print(df5.Name.str.swapcase())

%timeit -n 5 df5.Name2.s_str().swapcase()

%timeit -n 5 df5.Name1.s_str().swapcase()

%timeit -n 5 df5.Name.str.swapcase()

17.7 ms ± 773 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

18.9 ms ± 334 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

24.2 ms ± 140 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().title())

print(df5.Name1.s_str().title())

print(df5.Name.str.title())

%timeit -n 5 df5.Name2.s_str().title()

%timeit -n 5 df5.Name1.s_str().title()

%timeit -n 5 df5.Name.str.title()

17.9 ms ± 475 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

19.6 ms ± 384 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

24.4 ms ± 162 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().strip(b'Svensson, Mr. Johan'))

print(df5.Name1.s_str().strip(b'Svensson, Mr. Johan'))

print(df5.Name.str.strip('Svensson, Mr. Johan'))

%timeit -n 5 df5.Name2.s_str().strip(b'Svensson, Mr. Johan')

%timeit -n 5 df5.Name1.s_str().strip(b'Svensson, Mr. Johan')

%timeit -n 5 df5.Name.str.strip('Svensson, Mr. Johan')

22.1 ms ± 595 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

19.3 ms ± 336 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

19.4 ms ± 156 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().translate(bytes.maketrans(b'\x47',b'X')))

print(df5.Name1.s_str().translate(bytes.maketrans(b'\x47',b'X')))

print(df5.Name.str.translate(str.maketrans('G','X')))

%timeit -n 5 df5.Name2.s_str().translate(bytes.maketrans(b'\x47',b'X'))

%timeit -n 5 df5.Name1.s_str().translate(bytes.maketrans(b'\x47',b'X'))

%timeit -n 5 df5.Name.str.translate(str.maketrans('G','X'))

20 ms ± 486 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

20.8 ms ± 183 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

86.3 ms ± 173 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().upper())

print(df5.Name1.s_str().upper())

print(df5.Name.str.upper())

%timeit -n 5 df5.Name2.s_str().upper()

%timeit -n 5 df5.Name1.s_str().upper()

%timeit -n 5 df5.Name.str.upper()

13.4 ms ± 324 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

13.7 ms ± 172 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

15.4 ms ± 180 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

#################################################################

#################################################################

```



## Methods slower than Series.str



```python

print(df5.Name2.s_str().replace(rb'a\w{3,7}',b'xxx',regex=True))

print(df5.Name1.s_str().replace(rb'a\w{3,7}',b'xxx',regex=True))

print(df5.Name.str.replace(r'a\w{3,7}','xxx',regex=True))

%timeit -n 5 df5.Name2.s_str().replace(rb'a\w{3,7}',b'xxx',regex=True)

%timeit -n 5 df5.Name1.s_str().replace(rb'a\w{3,7}',b'xxx',regex=True)

%timeit -n 5 df5.Name.str.replace(r'a\w{3,7}','xxx',regex=True)

63 ms ± 504 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

63.4 ms ± 325 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

60 ms ± 326 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().removeprefix(b'A'))

print(df5.Name1.s_str().removeprefix(b'A'))

print(df5.Name.str.removeprefix('A'))

%timeit -n 5 df5.Name2.s_str().removeprefix(b'A')

%timeit -n 5 df5.Name1.s_str().removeprefix(b'A')

%timeit -n 5 df5.Name.str.removeprefix('A')

23.3 ms ± 625 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

23 ms ± 185 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

17.4 ms ± 163 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().isupper())

print(df5.Name1.s_str().isupper())

print(df5.Name.str.isupper())

%timeit -n 5 df5.Name2.s_str().isupper()

%timeit -n 5 df5.Name1.s_str().isupper()

%timeit -n 5 df5.Name.str.isupper()

8.98 ms ± 197 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

8.57 ms ± 48.5 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

8.49 ms ± 53.9 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().isspace())

print(df5.Name1.s_str().isspace())

print(df5.Name.str.isspace())

%timeit -n 5 df5.Name2.s_str().isspace()

%timeit -n 5 df5.Name1.s_str().isspace()

%timeit -n 5 df5.Name.str.isspace()

8.82 ms ± 226 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

8.61 ms ± 122 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

8.29 ms ± 73.4 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().islower())

print(df5.Name1.s_str().islower())

print(df5.Name.str.islower())

%timeit -n 5 df5.Name2.s_str().islower()

%timeit -n 5 df5.Name1.s_str().islower()

%timeit -n 5 df5.Name.str.islower()

9 ms ± 269 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

8.59 ms ± 81.4 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

8.37 ms ± 129 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().slice(start=1, stop=10, step=2))

print(df5.Name1.s_str().slice(start=1, stop=10, step=2))

print(df5.Name.str.slice(start=1, stop=10, step=2))

%timeit -n 5 df5.Name2.s_str().slice(start=1, stop=10, step=2)

%timeit -n 5 df5.Name1.s_str().slice(start=1, stop=10, step=2)

%timeit -n 5 df5.Name.str.slice(start=1, stop=10, step=2)

18.9 ms ± 304 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

19.1 ms ± 235 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

15.5 ms ± 160 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().rfind(b'A'))

print(df5.Name1.s_str().rfind(b'A'))

print(df5.Name.str.rfind('A'))

%timeit -n 5 df5.Name2.s_str().rfind(b'A')

%timeit -n 5 df5.Name1.s_str().rfind(b'A')

%timeit -n 5 df5.Name.str.rfind('A')

41 ms ± 618 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

41.2 ms ± 301 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

35.2 ms ± 216 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().startswith(b'Svensson, Mr. Johan'))

print(df5.Name1.s_str().startswith(b'Svensson, Mr. Johan'))

print(df5.Name.str.startswith('Svensson, Mr. Johan'))

%timeit -n 5 df5.Name2.s_str().startswith(b'Svensson, Mr. Johan')

%timeit -n 5 df5.Name1.s_str().startswith(b'Svensson, Mr. Johan')

%timeit -n 5 df5.Name.str.startswith('Svensson, Mr. Johan')

24.2 ms ± 511 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

24.4 ms ± 327 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

18.6 ms ± 296 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().rjust(100))

print(df5.Name1.s_str().rjust(100))

print(df5.Name.str.rjust(100))

%timeit -n 5 df5.Name2.s_str().rjust(100)

%timeit -n 5 df5.Name1.s_str().rjust(100)

%timeit -n 5 df5.Name.str.rjust(100)

23.6 ms ± 513 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

23.6 ms ± 160 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

18.7 ms ± 129 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().isdigit())

print(df5.Name1.s_str().isdigit())

print(df5.Name.str.isdigit())

%timeit -n 5 df5.Name2.s_str().isdigit()

%timeit -n 5 df5.Name1.s_str().isdigit()

%timeit -n 5 df5.Name.str.isdigit()

8.81 ms ± 209 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

8.45 ms ± 94 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

8.34 ms ± 77.4 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().rstrip(b'A'))

print(df5.Name1.s_str().rstrip(b'A'))

print(df5.Name.str.rstrip('A'))

%timeit -n 5 df5.Name2.s_str().rstrip(b'A')

%timeit -n 5 df5.Name1.s_str().rstrip(b'A')

%timeit -n 5 df5.Name.str.rstrip('A')

17.5 ms ± 598 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

17.2 ms ± 208 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

11.9 ms ± 159 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().rsplit(b'A'))

print(df5.Name1.s_str().rsplit(b'A'))

print(df5.Name.str.rsplit('A'))

%timeit -n 5 df5.Name2.s_str().rsplit(b'A')

%timeit -n 5 df5.Name1.s_str().rsplit(b'A')

%timeit -n 5 df5.Name.str.rsplit('A')

29 ms ± 700 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

29.2 ms ± 338 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

22.9 ms ± 215 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().rstrip(b'A'))

print(df5.Name1.s_str().rstrip(b'A'))

print(df5.Name.str.rstrip('A'))

%timeit -n 5 df5.Name2.s_str().rstrip(b'A')

%timeit -n 5 df5.Name1.s_str().rstrip(b'A')

%timeit -n 5 df5.Name.str.rstrip('A')

17.3 ms ± 441 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

17.3 ms ± 217 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

12.1 ms ± 132 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().match(b'zz'))

print(df5.Name1.s_str().match(b'zz'))

print(df5.Name.str.match('zz'))

%timeit -n 5 df5.Name2.s_str().match(b'zz')

%timeit -n 5 df5.Name1.s_str().match(b'zz')

%timeit -n 5 df5.Name.str.match('zz')

33.6 ms ± 718 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

32.6 ms ± 187 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

26.9 ms ± 286 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().lstrip(b'zz'))

print(df5.Name1.s_str().lstrip(b'zz'))

print(df5.Name.str.lstrip('zz'))

%timeit -n 5 df5.Name2.s_str().lstrip(b'zz')

%timeit -n 5 df5.Name1.s_str().lstrip(b'zz')

%timeit -n 5 df5.Name.str.lstrip('zz')

17.5 ms ± 447 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

17 ms ± 178 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

11.8 ms ± 98.1 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().lower())

print(df5.Name1.s_str().lower())

print(df5.Name.str.lower())

%timeit -n 5 df5.Name2.s_str().lower()

%timeit -n 5 df5.Name1.s_str().lower()

%timeit -n 5 df5.Name.str.lower()

13.5 ms ± 224 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

13.3 ms ± 168 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

11.9 ms ± 582 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().ljust(100))

print(df5.Name1.s_str().ljust(100))

print(df5.Name.str.ljust(100))

%timeit -n 5 df5.Name2.s_str().ljust(100)

%timeit -n 5 df5.Name1.s_str().ljust(100)

%timeit -n 5 df5.Name.str.ljust(100)

24.1 ms ± 540 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

23.8 ms ± 144 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

19.7 ms ± 146 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().removesuffix(b'A'))

print(df5.Name1.s_str().removesuffix(b'A'))

print(df5.Name.str.removesuffix('A'))

%timeit -n 5 df5.Name2.s_str().removesuffix(b'A')

%timeit -n 5 df5.Name1.s_str().removesuffix(b'A')

%timeit -n 5 df5.Name.str.removesuffix('A')

22.2 ms ± 672 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

22.2 ms ± 322 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

16.4 ms ± 86.2 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().len())

print(df5.Name1.s_str().len())

print(df5.Name.str.len())

%timeit -n 5 df5.Name2.s_str().len()

%timeit -n 5 df5.Name1.s_str().len()

%timeit -n 5 df5.Name.str.len()

24 ms ± 500 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

23.7 ms ± 275 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

17.8 ms ± 121 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().fullmatch(rb'(a\w{3})(\w+)'))

print(df5.Name1.s_str().fullmatch(rb'(a\w{3})(\w+)'))

print(df5.Name.str.fullmatch(r'(a\w{3})(\w+)'))

%timeit -n 5 df5.Name2.s_str().fullmatch(rb'(a\w{3})(\w+)')

%timeit -n 5 df5.Name1.s_str().fullmatch(rb'(a\w{3})(\w+)')

%timeit -n 5 df5.Name.str.fullmatch(r'(a\w{3})(\w+)')

29.3 ms ± 470 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

29.3 ms ± 330 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

23.9 ms ± 385 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().findall(rb'(a\w{3})(\w+)'))

print(df5.Name1.s_str().findall(rb'(a\w{3})(\w+)'))

print(df5.Name.str.findall(r'(a\w{3})(\w+)'))

%timeit -n 5 df5.Name2.s_str().findall(rb'(a\w{3})(\w+)')

%timeit -n 5 df5.Name1.s_str().findall(rb'(a\w{3})(\w+)')

%timeit -n 5 df5.Name.str.findall(r'(a\w{3})(\w+)')

42.8 ms ± 411 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

43.2 ms ± 506 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

39.5 ms ± 314 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().find(rb'(a\w{3})(\w+)'))

print(df5.Name1.s_str().find(rb'(a\w{3})(\w+)'))

print(df5.Name.str.find(r'(a\w{3})(\w+)'))

%timeit -n 5 df5.Name2.s_str().find(rb'(a\w{3})(\w+)')

%timeit -n 5 df5.Name1.s_str().find(rb'(a\w{3})(\w+)')

%timeit -n 5 df5.Name.str.find(r'(a\w{3})(\w+)')

40.5 ms ± 641 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

40.4 ms ± 175 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

34.5 ms ± 231 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().extractall(rb'(a\w{3})(\w+)'))

print(df5.Name1.s_str().extractall(rb'(a\w{3})(\w+)'))

print(df5.Name.str.extractall(r'(a\w{3})(\w+)'))

%timeit -n 5 df5.Name2.s_str().extractall(rb'(a\w{3})(\w+)')

%timeit -n 5 df5.Name1.s_str().extractall(rb'(a\w{3})(\w+)')

%timeit -n 5 df5.Name.str.extractall(r'(a\w{3})(\w+)')

165 ms ± 439 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

167 ms ± 346 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

156 ms ± 308 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().extract(rb'(a\w{3})'))

print(df5.Name1.s_str().extract(rb'(a\w{3})'))

print(df5.Name.str.extract(r'(a\w{3})'))

%timeit -n 5 df5.Name2.s_str().extract(rb'(a\w{3})')

%timeit -n 5 df5.Name1.s_str().extract(rb'(a\w{3})')

%timeit -n 5 df5.Name.str.extract(r'(a\w{3})')

64.7 ms ± 699 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

63.7 ms ± 343 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

55.8 ms ± 352 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().endswith(b'a'))

print(df5.Name1.s_str().endswith(b'a'))

print(df5.Name.str.endswith('a'))

%timeit -n 5 df5.Name2.s_str().endswith(b'a')

%timeit -n 5 df5.Name1.s_str().endswith(b'a')

%timeit -n 5 df5.Name.str.endswith('a')

24.4 ms ± 800 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

23.9 ms ± 97.7 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

18.2 ms ± 160 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().count(re.compile(b'a+')))

print(df5.Name1.s_str().count(re.compile(b'a+')))

print(df5.Name.str.count(re.compile('a+')))

%timeit -n 5 df5.Name2.s_str().count(re.compile(b'a+'))

%timeit -n 5 df5.Name1.s_str().count(re.compile(b'a+'))

%timeit -n 5 df5.Name.str.count(re.compile('a+'))

88.5 ms ± 407 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

94.7 ms ± 280 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

83.4 ms ± 238 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().zfill(100))

print(df5.Name1.s_str().zfill(100))

print(df5.Name.str.zfill(100))

%timeit -n 5 df5.Name2.s_str().zfill(100)

%timeit -n 5 df5.Name1.s_str().zfill(100)

%timeit -n 5 df5.Name.str.zfill(100)

22.9 ms ± 369 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

22.5 ms ± 216 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

17.9 ms ± 80.3 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().contains(b'a'))

print(df5.Name1.s_str().contains(b'a'))

print(df5.Name.str.contains('a'))

%timeit -n 5 df5.Name2.s_str().contains(b'a')

%timeit -n 5 df5.Name1.s_str().contains(b'a')

%timeit -n 5 df5.Name.str.contains('a')

30.5 ms ± 551 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

30.5 ms ± 287 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

24.4 ms ± 249 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().pad(width=100, side='both', fillchar=b'-'))

print(df5.Name1.s_str().pad(width=100, side='both', fillchar=b'-'))

print(df5.Name.str.pad(width=100, side='both', fillchar='-'))

%timeit -n 5 df5.Name2.s_str().pad(width=100, side='both', fillchar=b'-')

%timeit -n 5 df5.Name1.s_str().pad(width=100, side='both', fillchar=b'-')

%timeit -n 5 df5.Name.str.pad(width=100, side='both', fillchar='-')

23.9 ms ± 579 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

24.2 ms ± 411 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

19.5 ms ± 77.7 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().center(width=5))

print(df5.Name1.s_str().center(width=5))

print(df5.Name.str.center(width=5))

%timeit -n 5 df5.Name2.s_str().center(width=5)

%timeit -n 5 df5.Name1.s_str().center(width=5)

%timeit -n 5 df5.Name.str.center(width=5)

17.7 ms ± 368 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

18 ms ± 327 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

12.5 ms ± 75.7 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

```



## Methods much slower than Series.str



```python

print(df5.Name2.s_str().cat())

print(df5.Name1.s_str().cat())

print(df5.Name.str.cat())

%timeit -n 5 df5.Name2.s_str().cat()

%timeit -n 5 df5.Name1.s_str().cat()

%timeit -n 5 df5.Name.str.cat()

14.1 ms ± 706 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

13.9 ms ± 877 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

3.74 ms ± 17.6 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().casefold())

print(df5.Name1.s_str().casefold())

print(df5.Name.str.casefold())

%timeit -n 5 df5.Name2.s_str().casefold()

%timeit -n 5 df5.Name1.s_str().casefold()

%timeit -n 5 df5.Name.str.casefold()

168 ms ± 556 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

200 ms ± 466 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

11.5 ms ± 115 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().join(b'zz'))

print(df5.Name1.s_str().join(b'zz'))

print(df5.Name.str.join('zz'))

%timeit -n 5 df5.Name2.s_str().join(b'zz')

%timeit -n 5 df5.Name1.s_str().join(b'zz')

%timeit -n 5 df5.Name.str.join('zz')

360 ms ± 2.22 ms per loop (mean ± std. dev. of 7 runs, 5 loops each)

366 ms ± 514 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

54 ms ± 271 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().normalize(form='NFC'))

print(df5.Name1.s_str().normalize(form='NFC'))

print(df5.Name.str.normalize(form='NFC'))

%timeit -n 5 df5.Name2.s_str().normalize(form='NFC')

%timeit -n 5 df5.Name1.s_str().normalize(form='NFC')

%timeit -n 5 df5.Name.str.normalize(form='NFC')

173 ms ± 892 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

189 ms ± 688 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

17.7 ms ± 127 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().wrap(10))

print(df5.Name1.s_str().wrap(10))

print(df5.Name.str.wrap(10))

%timeit -n 5 df5.Name2.s_str().wrap(10)

%timeit -n 5 df5.Name1.s_str().wrap(10)

%timeit -n 5 df5.Name.str.wrap(10)

1.48 s ± 67.7 ms per loop (mean ± std. dev. of 7 runs, 5 loops each)

1.55 s ± 25.5 ms per loop (mean ± std. dev. of 7 runs, 5 loops each)

899 ms ± 1.11 ms per loop (mean ± std. dev. of 7 runs, 5 loops each)

#################################################################

print(df5.Name2.s_str().get(1))

print(df5.Name1.s_str().get(1))

print(df5.Name.str.get(1))

%timeit -n 5 df5.Name2.s_str().get(1)

%timeit -n 5 df5.Name1.s_str().get(1)

%timeit -n 5 df5.Name.str.get(1)

45 ms ± 604 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

44.8 ms ± 294 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

24.5 ms ± 644 µs per loop (mean ± std. dev. of 7 runs, 5 loops each)

```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/a_pandas_ex_fastloc",
    "name": "a-pandas-ex-fastloc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "numexpr,numpy,loc,iloc,pandas,series",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e7/58/e82d9b7dd8848857bd660f98c349583f84c3593e33f70cd7f7be8e448b63/a_pandas_ex_fastloc-0.11.tar.gz",
    "platform": null,
    "description": "\n# Extremely fast by combining np.select and numexpr.evaluate (works with utf-8!)\n\n\n\n### Here is a simple query:\n\n\n\n[https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv](https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv)\n\n\n\n```python\n\n%timeit (df.PassengerId >800) | (df.PassengerId <60)\n\n194 \u00b5s \u00b1 586 ns per loop (mean \u00b1 std. dev. of 7 runs, 10,000 loops each)\n\n```\n\n\n\n**When you're working with pandas, speed matters!.**\n\n\n\n### Well, there are 2 tricks to tremendously increase the speed of Pandas\n\n\n\n**(Here are 2 examples: in case you have never heard about them)**\n\n\n\n#### 1) np.select\n\n\n\n```python\n\nb=df.PassengerId.__array__()\n\n%timeit np.select([b>800, b<60], [True,True], False)\n\n21.5 \u00b5s \u00b1 44.5 ns per loop (mean \u00b1 std. dev. of 7 runs, 10,000 loops each)\n\n```\n\n\n\n#### 2) numexpr.evaluate\n\n\n\n```python\n\nb=df.PassengerId.__array__()\n\n%timeit [numexpr.evaluate('(b > 800)|(b < 60)')]\n\n10.5 \u00b5s \u00b1 25 ns per loop (mean \u00b1 std. dev. of 7 runs, 100,000 loops each)\n\n```\n\n\n\n#### Combining both\n\n\n\nWell, why not combining those two?  numexpr.evaluate to do the queries, and np.select to filter the queries (True/False)\n\n\n\nThe problem is that numexpr has many limitations:\n\n\n\n[https://numexpr.readthedocs.io/projects/NumExpr3/en/latest/user_guide.html#supported-operators](https://numexpr.readthedocs.io/projects/NumExpr3/en/latest/user_guide.html#supported-operators)\n\n\n\nIf you are working with numbers, you probably won't miss a lot, \n\n\n\nbut with strings, it is different: numexpr nor supports the utf-8 format neither regex.\n\n\n\nI am a German teacher and work most of the time with DataFrames containing strings (mainly bilingual dictionaries)\n\n\n\nanywhere from 500 to 10000000 rows. Unfortunately, it is not that easy converting German words \n\n\n\n to ASCII strings due to the special characters (\u00f6, \u00e4 ...)\n\n\n\nI found a way to simplify the conversion either way, without losing the special characters:\n\n\n\n```python\n\ndf.Name.s_str().s_to_ascii()\n\ndf.Nameuni.s_str().s_to_utf8()\n\n```\n\n\n\nBut converting them all the time back and forth (to use **Series.str [only UTF-8]**) doesn't make any sense, \n\n\n\nbecause we are loosing all the speed gained from numexpr.evaluate/np.select.\n\n\n\nUnfortunately, **Series.str** doesn't accept binary data. \n\n\n\nBut since I use all methods of the Series.str class frequently and \n\n\n\nI also want the benefits of numexpr.evaluate/np.select, I changed \n\n\n\nalmost all methods of Series.str to make them work with binary data.\n\n\n\n**Don\u2019t be afraid**:\n\n\n\nIt won\u2019t overwrite **Series.str**, it just adds **s_str**(parenthesis when you want to access the methods!)\n\n\n\nSome of the adapted methods are faster, some are slower (still faster than converting)\n\n\n\nand some are really slow, and should not be used (casefold/wrap/normalize)\n\n\n\nand few of them are not working yet [(encode/decode) \u2192 adaption probably senseless].\n\n\n\nAnd of course, the new insanely fast methods:\n\n\n\n```python\n\ns_uniascii_contains # only for strings, pass strings as utf-8\n\ns_uniascii_equal # only for strings, pass strings as utf-8\n\nd_floc # replacement for df.loc / combine it with numexpr.evaluate \n\nget_compiled_regex_from_wordlist  # instead of searching [Maria, Carlos, ...], use this function to generate a binary Trie regex\n\n```\n\n\n\nScroll down to see the execution speed of every method compared to **Series.str**\n\n\n\n## How to use\n\n\n\n```python\n\nfrom a_pandas_ex_fastloc import pd_add_fastloc,get_byte_regex,get_compiled_regex_from_wordlist,convert_utf8_to_ascii\n\npd_add_fastloc()\n\nimport pandas as pd\n\ndf = pd.read_csv(\"https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv\")\n\ndf['Nameuni'] = df.Name + '\u00f6' # get some utf-8 data with special characters\n\ndf['Nameuni2'] = df['Nameuni'].s_str().s_to_ascii()\n\ndfbig = pd.concat([df.copy() for x in range(100)],ignore_index=True)\n\ndfbigbig = pd.concat([df.copy() for x in range(1000)],ignore_index=True)\n\n```\n\n\n\n### # The highlights\n\n\n\n#### s_uniascii_contains\n\n\n\n```python\n\n%timeit dfbigbig.loc[dfbigbig.Nameuni.str.contains('Harris\u00f6')]\n\n239 ms \u00b1 1.62 ms per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n\n%timeit dfbigbig.loc[dfbigbig.Nameuni2.s_str().s_uniascii_contains('Harris\u00f6')]\n\n14.7 ms \u00b1 111 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 100 loops each)\n\n```\n\n\n\n### s_uniascii_equal\n\n\n\n```python\n\n%timeit dfbigbig.loc[dfbigbig.Nameuni == 'Braund, Mr. Owen Harris\u00f6']\n\n29.3 ms \u00b1 179 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 10 loops each)\n\n%timeit dfbigbig.loc[dfbigbig.Nameuni2.s_str().s_uniascii_equal('Braund, Mr. Owen Harris\u00f6')]\n\n3.89 ms \u00b1 5.78 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 100 loops each)\n\n```\n\n\n\n### s_to_utf8\n\n\n\n```python\n\n# Data can be converted easily to utf-8:\n\ndfbigbig.loc[dfbigbig.Nameuni2.s_str().s_uniascii_contains('Harris\u00f6')].Nameuni2.s_str().s_to_utf8()\n\nOut[65]: \n\n0         Braund, Mr. Owen Harris\u00f6\n\n891       Braund, Mr. Owen Harris\u00f6\n\n1782      Braund, Mr. Owen Harris\u00f6\n\n2673      Braund, Mr. Owen Harris\u00f6\n\n3564      Braund, Mr. Owen Harris\u00f6\n\n                    ...           \n\nName: Nameuni2, Length: 1000, dtype: object\n\n```\n\n\n\n### d_floc\n\n\n\n```python\n\n# You can also use numbers, but you won't get a speedup for simple queries\n\n%timeit -n 4 dfbigbig.d_floc([('(Age > 10)',True)]) \n\n%timeit -n 4 dfbigbig.loc[dfbigbig.Age > 10]\n\n139 ms \u00b1 562 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 4 loops each)\n\n140 ms \u00b1 486 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 4 loops each)\n\n```\n\n\n\n```python\n\n# Once the query gets more sophisticated, things are different:\n\n%timeit -n 4 dfbigbig.d_floc([('((Age*3221/3220 > (10*.432/.431)) & (PassengerId%10 ==0))',True)])\n\n%timeit -n 4 dfbigbig.loc[(dfbigbig.Age*3221/3220 > 10*.432/.431) & (dfbigbig.PassengerId %10 ==0)]\n\n23.4 ms \u00b1 583 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 4 loops each)\n\n35.2 ms \u00b1 342 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 4 loops each)\n\n```\n\n\n\n```python\n\n%timeit -n 4 dfbigbig.d_floc([('((Age*3221/3220 > (10*.432/.431)) & (PassengerId%10 ==0))',True),(f'contains(Nameuni2,{repr(convert_utf8_to_ascii(\"Harris\u00f6\"))})',True)], convertstr=False)\n\n%timeit -n 4 dfbigbig.loc[((dfbigbig.Age*3221/3220 > 10*.432/.431) & (dfbigbig.PassengerId %10 ==0)) | dfbigbig.Nameuni.str.contains(\"Harris\u00f6\")]\n\n39.8 ms \u00b1 1.01 ms per loop (mean \u00b1 std. dev. of 7 runs, 4 loops each)\n\n272 ms \u00b1 1.12 ms per loop (mean \u00b1 std. dev. of 7 runs, 4 loops each)\n\n\n\n# Different ways of doing the query, check out the numexpr documentation\n\n%timeit -n 4 dfbigbig.d_floc([('((Age*3221/3220 > (10*.432/.431)) & (PassengerId%10 ==0))',True),(f'contains(Nameuni2,{repr(convert_utf8_to_ascii(\"Harris\u00f6\"))})',True)], convertstr=False)\n\n%timeit -n 4 dfbigbig.d_floc([(f'((Age*3221/3220 > (10*.432/.431)) & (PassengerId%10 ==0)) | contains(Nameuni2,{repr(convert_utf8_to_ascii(\"Harris\u00f6\"))})',True)], convertstr=False)\n\n```\n\n\n\n```python\n\n# How to negate results (operator ~)\n\n%timeit -n 4 dfbigbig.d_floc([(f'((Age*3221/3220 > (10*.432/.431)) & (PassengerId%10 ==0)) | contains(Nameuni2,{repr(convert_utf8_to_ascii(\"Harris\u00f6\"))})',False)], convertstr=False, default=True)\n\n%timeit -n 4 dfbigbig.loc[~(((dfbigbig.Age*3221/3220 > 10*.432/.431) & (dfbigbig.PassengerId %10 ==0)) | dfbigbig.Nameuni.str.contains(\"Harris\u00f6\"))]\n\n194 ms \u00b1 1.55 ms per loop (mean \u00b1 std. dev. of 7 runs, 4 loops each)\n\n436 ms \u00b1 3.34 ms per loop (mean \u00b1 std. dev. of 7 runs, 4 loops each)\n\n```\n\n\n\n```python\n\n# without converting the Series with utf-8 strings to ASCII\n\nqueries=[('contains(Name, \"Maria\")',True)]\n\n# convertstr=True -> Converts utf-8 to bytes, must be True if the column is not ASCII, and False if ASCII \n\n%timeit df.d_floc(queries, default=False, convertstr=True) \n\n%timeit df.loc[df.Name.str.contains('Maria')]\n\n\n\n# Even though, the Series has been converted to bytes in every loop, fastloc is still much faster:\n\n329 \u00b5s \u00b1 4.25 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 1,000 loops each)\n\n491 \u00b5s \u00b1 2.14 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 1,000 loops each)\n\n```\n\n\n\n```python\n\n# How to convert\n\ndf['Name2'] = df.Name.s_str().s_to_ascii()\n\n# works also with special characters (\u00f6, \u00ef ...)\n\ndf['Nameuni2'] = df.Nameuni.s_str().s_to_ascii()\n\n```\n\n\n\n```python\n\n# Faster when converted (convertstr=False)\n\nqueries=[('contains(Name2, \"Maria\")',True)]\n\n%timeit df.d_floc(queries, default=False, convertstr=False) \n\n%timeit df.loc[df.Name.str.contains('Maria')]\n\n270 \u00b5s \u00b1 1.29 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 1,000 loops each)\n\n510 \u00b5s \u00b1 1.15 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 1,000 loops each)\n\n```\n\n\n\n```python\n\n# You can also use: \n\n%timeit df.loc[df.Name2.s_str().s_uniascii_contains('Maria')]\n\n\n\n# The bigger the dataframe, the better:\n\ndfbig['Nameuni2'] = dfbig.Nameuni.s_str().s_to_ascii()\n\ndfbig['Name2'] = dfbig.Name.s_str().s_to_ascii()\n\nqueries=[('contains(Name2, \"Maria\")',True)]\n\n%timeit dfbig.d_floc(queries, default=False, convertstr=False) \n\n%timeit dfbig.loc[dfbig.Name.str.contains('Maria')]\n\n2.04 ms \u00b1 206 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 1,000 loops each)\n\n25.6 ms \u00b1 90.1 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 10 loops each)\n\n\n\n\n\ndfbigbig['Nameuni2'] = dfbigbig.Nameuni.s_str().s_to_ascii()\n\ndfbigbig['Name2'] = dfbigbig.Name.s_str().s_to_ascii()\n\nqueries=[('contains(Name2, \"Maria\")',True)]\n\n%timeit dfbigbig.d_floc(queries, default=False, convertstr=False) \n\n%timeit dfbigbig.loc[dfbigbig.Name.str.contains('Maria')]\n\n18.3 ms \u00b1 347 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 100 loops each)\n\n251 ms \u00b1 392 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n\n```\n\n\n\n```python\n\n# Converting the results to unicode:\n\ndfbigbig.d_floc(queries, default=False, convertstr=False).Nameuni2 .s_str().s_to_utf8()\n\nOut[42]: \n\n18        Vander Planke, Mrs. Julius (Emelia Maria Vande...\n\n38                      Vander Planke, Miss. Augusta Maria\u00f6\n\n85        Backstrom, Mrs. Karl Alfred (Maria Mathilda Gu...\n\n119                      Andersson, Miss. Ellis Anna Maria\u00f6\n\n307       Penasco y Castellana, Mrs. Victor de Satode (M...\n\n                                ...                        \n\n890535         Clarke, Mrs. Charles V (Ada Maria Winfield)\u00f6\n\n890687                    Caram, Mrs. Joseph (Maria Elias)\u00f6\n\n890690    Thayer, Mrs. John Borland (Marian Longstreth M...\n\n890747              Panula, Mrs. Juha (Maria Emilia Ojala)\u00f6\n\n890925                        Heininen, Miss. Wendla Maria\u00f6\n\nName: Nameuni2, Length: 12000, dtype: object\n\n```\n\n\n\n### convert_utf8_to_ascii\n\n\n\n```python\n\n# Searching for Unicode using numexpr directly\n\n# Use this to convert the string to bin: {repr(convert_utf8_to_ascii(\"Harris\u00f6\"))}\n\nqueriesuni=[(f'contains(Nameuni2, {repr(convert_utf8_to_ascii(\"Harris\u00f6\"))})',True)]\n\n%timeit df.d_floc(queriesuni, default=False, convertstr=False) \n\n\n\n293 \u00b5s \u00b1 974 ns per loop (mean \u00b1 std. dev. of 7 runs, 1,000 loops each)\n\n\n\n\n\nOut[11]: \n\n   PassengerId  ...                           Nameuni2\n\n0            1  ...  b'Braund, Mr. Owen Harris\\\\u00f6'\n\n[1 rows x 15 columns]\n\n\n\n# Convert to utf-8\n\ndf.d_floc(queriesuni, default=False, convertstr=False).Nameuni2.s_str().s_to_utf8()\n\nOut[17]: \n\n0    Braund, Mr. Owen Harris\u00f6\n\nName: Nameuni2, dtype: object\n\n\n\n#################################################################\n\n%timeit df.loc[df.Nameuni.str.contains('Harris\u00f6')]\n\n514 \u00b5s \u00b1 2.82 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 1,000 loops each)\n\nOut[13]: \n\n   PassengerId  ...                           Nameuni2\n\n0            1  ...  b'Braund, Mr. Owen Harris\\\\u00f6'\n\n[1 rows x 15 columns]\n\n```\n\n\n\n### get_byte_regex\n\n\n\n```python\n\n# Regex works too, but be careful with special characters\n\n\n\n# Avoid this because you might get other results than you want:\n\ncomp0 = get_byte_regex('^.*?[\u00f6\u00e4]$')\n\nprint(comp0)\n\nre.compile(b'^.*?[\\\\\\\\u00f6\\\\\\\\u00e4]$')\n\n\n\n# Better\n\ncomp1=get_byte_regex('^.*?(?:(?:\u00f6)|(?:\u00e4))$')\n\nprint(comp1)\n\nre.compile(b'^.*?(?:(?:\\\\\\\\u00f6)|(?:\\\\\\\\u00e4))$')\n\n\n\n%timeit df.Nameuni2.s_str().findall(comp1)\n\n%timeit df.Nameuni.str.findall('^.*?(?:(?:\u00f6)|(?:\u00e4))$')\n\n\n\n# Not much faster, but at least a little\n\n633 \u00b5s \u00b1 1.35 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 1,000 loops each)\n\n641 \u00b5s \u00b1 906 ns per loop (mean \u00b1 std. dev. of 7 runs, 1,000 loops each)\n\n\n\nOut[21]: \n\n0                    [b'Braund, Mr. Owen Harris\\\\u00f6']\n\n1      [b'Cumings, Mrs. John Bradley (Florence Briggs...\n\n2                     [b'Heikkinen, Miss. Laina\\\\u00f6']\n\n3      [b'Futrelle, Mrs. Jacques Heath (Lily May Peel...\n\n4                   [b'Allen, Mr. William Henry\\\\u00f6']\n\n                             ...                        \n\n886                    [b'Montvila, Rev. Juozas\\\\u00f6']\n\n887             [b'Graham, Miss. Margaret Edith\\\\u00f6']\n\n888    [b'Johnston, Miss. Catherine Helen \\\\\"Carrie\\\\...\n\n889                    [b'Behr, Mr. Karl Howell\\\\u00f6']\n\n890                      [b'Dooley, Mr. Patrick\\\\u00f6']\n\nName: Nameuni2, Length: 891, dtype: object\n\n\n\nOut[22]: \n\n0                             [Braund, Mr. Owen Harris\u00f6]\n\n1      [Cumings, Mrs. John Bradley (Florence Briggs T...\n\n2                              [Heikkinen, Miss. Laina\u00f6]\n\n3        [Futrelle, Mrs. Jacques Heath (Lily May Peel)\u00f6]\n\n4                            [Allen, Mr. William Henry\u00f6]\n\n                             ...                        \n\n886                             [Montvila, Rev. Juozas\u00f6]\n\n887                      [Graham, Miss. Margaret Edith\u00f6]\n\n888          [Johnston, Miss. Catherine Helen \"Carrie\"\u00f6]\n\n889                             [Behr, Mr. Karl Howell\u00f6]\n\n890                               [Dooley, Mr. Patrick\u00f6]\n\nName: Nameuni, Length: 891, dtype: object\n\n\n\n\n\n# With big DataFrames\n\n%timeit dfbigbig.Nameuni2.s_str().findall(comp1)\n\n%timeit dfbigbig.Nameuni.str.findall('^.*?(?:(?:\u00f6)|(?:\u00e4))$')\n\n556 ms \u00b1 2.61 ms per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n\n571 ms \u00b1 2.52 ms per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n\n#################################################################\n\n# You can use all regex methods from a Series.str. \n\n# But usually no speedup when using regex (sometimes a little faster, sometimes a little slower)\n\nregexpextractall='^.*?((?:\u00f6)|(?:\u00e4))$'\n\ncomp1=get_byte_regex(regexpextractall)\n\n%timeit dfbig.Nameuni2.s_str().extractall(comp1)\n\n%timeit dfbig.Nameuni.str.extractall(regexpextractall)\n\n209 ms \u00b1 2.65 ms per loop (mean \u00b1 std. dev. of 7 runs, 1 loop each)\n\n206 ms \u00b1 3.98 ms per loop (mean \u00b1 std. dev. of 7 runs, 10 loops each)\n\n\n\nregexpextractall='^.*?((?:\u00f6)|(?:\u00e4))$'\n\ncomp1=get_byte_regex(regexpextractall)\n\n%timeit dfbig.Nameuni2.s_str().replace(comp1, b'XX',regex=True)\n\n%timeit dfbig.Nameuni.str.replace(regexpextractall, 'XX',regex=True)\n\n69.9 ms \u00b1 747 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 10 loops each)\n\n71.5 ms \u00b1 293 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 10 loops each)\n\n\n\n#################################################################\n\n```\n\n\n\n### get_compiled_regex_from_wordlist\n\n\n\n```python\n\n# If you have a list of words, create a Trie regex:\n\n# e.g. all names with starting with M\n\nlotsofwords = ([o for o in set([re.sub(r'\\W+','',x) for x in \"\\n\".join(df.Name.unique().tolist()).split()]) if o.startswith('M')])\n\nlotsofwordsre=get_compiled_regex_from_wordlist(\n\n        wordlist=lotsofwords,\n\n        boundary_right=True,\n\n        boundary_left=True,\n\n        capture=False,\n\n        match_whole_line=False,\n\n    flags=re.I\n\n    )\n\n%timeit df.loc[df.Name.apply(lambda x: True if [y for y in lotsofwords if y in x] else False)]\n\n%timeit df.loc[df.Name2.s_str().contains(lotsofwordsre,regex=True)]\n\n7.02 ms \u00b1 47.1 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 100 loops each)\n\n914 \u00b5s \u00b1 1.45 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 1,000 loops each)\n\n#################################################################\n\n```\n\n\n\n## Methods faster than Series.str\n\n\n\n```python\n\n# To avoid converting back and forth all the time (ascii - utf-8)\n\n# I adapted most of the methods from the Series.str class \n\n# to work with bytes \n\n# Some methods are faster, some are slower and some are really slow \n\n# (casefold/wrap/normalize)\n\n# But surely better than converting all the time \n\n\n\n# Lets create a copy of the DF\n\ndf5=dfbig.copy()\n\ndf5['Name1'] = df5.Nameuni2.copy() \n\n```\n\n\n\n```python\n\n#################################################################\n\nprint(df5.Name2.s_str().capitalize())\n\nprint(df5.Name1.s_str().capitalize())\n\nprint(df5.Name.str.capitalize())\n\n%timeit -n 5 df5.Name2.s_str().capitalize()\n\n%timeit -n 5 df5.Name1.s_str().capitalize()\n\n%timeit -n 5 df5.Name.str.capitalize()\n\n13.8 ms \u00b1 313 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n13.9 ms \u00b1 153 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n20.5 ms \u00b1 169 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\n# Not part of Series.str, but similar to Series.str.contains\n\nprint(df5.Name2.s_str().s_uniascii_equal('Svensson, Mr. Johan'))\n\nprint(df5.Name1.s_str().s_uniascii_equal('Svensson, Mr. Johan'))\n\nprint(df5.loc[df5.Name == 'Svensson, Mr. Johan'])\n\n%timeit -n 5 df5.Name2.s_str().s_uniascii_equal('Svensson, Mr. Johan')\n\n%timeit -n 5 df5.Name1.s_str().s_uniascii_equal('Svensson, Mr. Johan')\n\n%timeit -n 5 df5.loc[df5.Name == ('Svensson, Mr. Johan')]\n\n350 \u00b5s \u00b1 126 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n317 \u00b5s \u00b1 27.4 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n3.13 ms \u00b1 34.7 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\n# Not part of Series.str, but similar to Series.str.contains\n\nprint(df5.Name2.s_str().s_uniascii_contains('a'))\n\nprint(df5.Name1.s_str().s_uniascii_contains('a'))\n\nprint(df5.Name.str.contains('a'))\n\n%timeit -n 5 df5.Name2.s_str().s_uniascii_contains('a')\n\n%timeit -n 5 df5.Name1.s_str().s_uniascii_contains('a')\n\n%timeit -n 5 df5.Name.str.contains('a')\n\n1.12 ms \u00b1 73.1 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n1.07 ms \u00b1 16.4 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n24.6 ms \u00b1 506 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().isalnum())\n\nprint(df5.Name1.s_str().isalnum())\n\nprint(df5.Name.str.isalnum())\n\n%timeit -n 5 df5.Name2.s_str().isalnum()\n\n%timeit -n 5 df5.Name1.s_str().isalnum()\n\n%timeit -n 5 df5.Name.str.isalnum()\n\n9.67 ms \u00b1 125 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n9.44 ms \u00b1 74.2 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n10 ms \u00b1 122 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().isalpha())\n\nprint(df5.Name1.s_str().isalpha())\n\nprint(df5.Name.str.isalpha())\n\n%timeit -n 5 df5.Name2.s_str().isalpha()\n\n%timeit -n 5 df5.Name1.s_str().isalpha()\n\n%timeit -n 5 df5.Name.str.isalpha()\n\n9.74 ms \u00b1 164 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n9.45 ms \u00b1 91.4 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n9.77 ms \u00b1 44.4 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().istitle())\n\nprint(df5.Name1.s_str().istitle())\n\nprint(df5.Name.str.istitle())\n\n%timeit -n 5 df5.Name2.s_str().istitle()\n\n%timeit -n 5 df5.Name1.s_str().istitle()\n\n%timeit -n 5 df5.Name.str.istitle()\n\n14 ms \u00b1 563 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n13.8 ms \u00b1 83.5 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n17.5 ms \u00b1 188 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().partition())\n\nprint(df5.Name1.s_str().partition())\n\nprint(df5.Name.str.partition())\n\n%timeit -n 5 df5.Name2.s_str().partition()\n\n%timeit -n 5 df5.Name1.s_str().partition()\n\n%timeit -n 5 df5.Name.str.partition()\n\n86.8 ms \u00b1 817 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n86.8 ms \u00b1 297 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n89.5 ms \u00b1 412 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().rpartition())\n\nprint(df5.Name1.s_str().rpartition())\n\nprint(df5.Name.str.rpartition())\n\n%timeit -n 5 df5.Name2.s_str().rpartition()\n\n%timeit -n 5 df5.Name1.s_str().rpartition()\n\n%timeit -n 5 df5.Name.str.rpartition()\n\n89.1 ms \u00b1 773 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n90.2 ms \u00b1 490 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n90.5 ms \u00b1 383 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().repeat(100))\n\nprint(df5.Name1.s_str().repeat(100))\n\nprint(df5.Name.str.repeat(100))\n\n%timeit -n 5 df5.Name2.s_str().repeat(100)\n\n%timeit -n 5 df5.Name1.s_str().repeat(100)\n\n%timeit -n 5 df5.Name.str.repeat(100)\n\n75.7 ms \u00b1 4.08 ms per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n92.6 ms \u00b1 5.07 ms per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n113 ms \u00b1 387 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().slice_replace(start=1, stop=10, repl=b'2'))\n\nprint(df5.Name1.s_str().slice_replace(start=1, stop=10, repl=b'2'))\n\nprint(df5.Name.str.slice_replace(start=1, stop=10, repl='2'))\n\n%timeit -n 5 df5.Name2.s_str().slice_replace(start=1, stop=10, repl=b'2')\n\n%timeit -n 5 df5.Name1.s_str().slice_replace(start=1, stop=10, repl=b'2')\n\n%timeit -n 5 df5.Name.str.slice_replace(start=1, stop=10, repl='2')\n\n30.8 ms \u00b1 544 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n31 ms \u00b1 285 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n44.5 ms \u00b1 281 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().split())\n\nprint(df5.Name1.s_str().split())\n\nprint(df5.Name.str.split())\n\n%timeit -n 5 df5.Name2.s_str().split()\n\n%timeit -n 5 df5.Name1.s_str().split()\n\n%timeit -n 5 df5.Name.str.split()\n\n39.1 ms \u00b1 558 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n39.8 ms \u00b1 280 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n40.1 ms \u00b1 244 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().swapcase())\n\nprint(df5.Name1.s_str().swapcase())\n\nprint(df5.Name.str.swapcase())\n\n%timeit -n 5 df5.Name2.s_str().swapcase()\n\n%timeit -n 5 df5.Name1.s_str().swapcase()\n\n%timeit -n 5 df5.Name.str.swapcase()\n\n17.7 ms \u00b1 773 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n18.9 ms \u00b1 334 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n24.2 ms \u00b1 140 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().title())\n\nprint(df5.Name1.s_str().title())\n\nprint(df5.Name.str.title())\n\n%timeit -n 5 df5.Name2.s_str().title()\n\n%timeit -n 5 df5.Name1.s_str().title()\n\n%timeit -n 5 df5.Name.str.title()\n\n17.9 ms \u00b1 475 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n19.6 ms \u00b1 384 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n24.4 ms \u00b1 162 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().strip(b'Svensson, Mr. Johan'))\n\nprint(df5.Name1.s_str().strip(b'Svensson, Mr. Johan'))\n\nprint(df5.Name.str.strip('Svensson, Mr. Johan'))\n\n%timeit -n 5 df5.Name2.s_str().strip(b'Svensson, Mr. Johan')\n\n%timeit -n 5 df5.Name1.s_str().strip(b'Svensson, Mr. Johan')\n\n%timeit -n 5 df5.Name.str.strip('Svensson, Mr. Johan')\n\n22.1 ms \u00b1 595 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n19.3 ms \u00b1 336 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n19.4 ms \u00b1 156 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().translate(bytes.maketrans(b'\\x47',b'X')))\n\nprint(df5.Name1.s_str().translate(bytes.maketrans(b'\\x47',b'X')))\n\nprint(df5.Name.str.translate(str.maketrans('G','X')))\n\n%timeit -n 5 df5.Name2.s_str().translate(bytes.maketrans(b'\\x47',b'X'))\n\n%timeit -n 5 df5.Name1.s_str().translate(bytes.maketrans(b'\\x47',b'X'))\n\n%timeit -n 5 df5.Name.str.translate(str.maketrans('G','X'))\n\n20 ms \u00b1 486 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n20.8 ms \u00b1 183 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n86.3 ms \u00b1 173 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().upper())\n\nprint(df5.Name1.s_str().upper())\n\nprint(df5.Name.str.upper())\n\n%timeit -n 5 df5.Name2.s_str().upper()\n\n%timeit -n 5 df5.Name1.s_str().upper()\n\n%timeit -n 5 df5.Name.str.upper()\n\n13.4 ms \u00b1 324 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n13.7 ms \u00b1 172 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n15.4 ms \u00b1 180 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\n#################################################################\n\n#################################################################\n\n```\n\n\n\n## Methods slower than Series.str\n\n\n\n```python\n\nprint(df5.Name2.s_str().replace(rb'a\\w{3,7}',b'xxx',regex=True))\n\nprint(df5.Name1.s_str().replace(rb'a\\w{3,7}',b'xxx',regex=True))\n\nprint(df5.Name.str.replace(r'a\\w{3,7}','xxx',regex=True))\n\n%timeit -n 5 df5.Name2.s_str().replace(rb'a\\w{3,7}',b'xxx',regex=True)\n\n%timeit -n 5 df5.Name1.s_str().replace(rb'a\\w{3,7}',b'xxx',regex=True)\n\n%timeit -n 5 df5.Name.str.replace(r'a\\w{3,7}','xxx',regex=True)\n\n63 ms \u00b1 504 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n63.4 ms \u00b1 325 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n60 ms \u00b1 326 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().removeprefix(b'A'))\n\nprint(df5.Name1.s_str().removeprefix(b'A'))\n\nprint(df5.Name.str.removeprefix('A'))\n\n%timeit -n 5 df5.Name2.s_str().removeprefix(b'A')\n\n%timeit -n 5 df5.Name1.s_str().removeprefix(b'A')\n\n%timeit -n 5 df5.Name.str.removeprefix('A')\n\n23.3 ms \u00b1 625 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n23 ms \u00b1 185 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n17.4 ms \u00b1 163 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().isupper())\n\nprint(df5.Name1.s_str().isupper())\n\nprint(df5.Name.str.isupper())\n\n%timeit -n 5 df5.Name2.s_str().isupper()\n\n%timeit -n 5 df5.Name1.s_str().isupper()\n\n%timeit -n 5 df5.Name.str.isupper()\n\n8.98 ms \u00b1 197 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n8.57 ms \u00b1 48.5 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n8.49 ms \u00b1 53.9 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().isspace())\n\nprint(df5.Name1.s_str().isspace())\n\nprint(df5.Name.str.isspace())\n\n%timeit -n 5 df5.Name2.s_str().isspace()\n\n%timeit -n 5 df5.Name1.s_str().isspace()\n\n%timeit -n 5 df5.Name.str.isspace()\n\n8.82 ms \u00b1 226 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n8.61 ms \u00b1 122 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n8.29 ms \u00b1 73.4 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().islower())\n\nprint(df5.Name1.s_str().islower())\n\nprint(df5.Name.str.islower())\n\n%timeit -n 5 df5.Name2.s_str().islower()\n\n%timeit -n 5 df5.Name1.s_str().islower()\n\n%timeit -n 5 df5.Name.str.islower()\n\n9 ms \u00b1 269 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n8.59 ms \u00b1 81.4 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n8.37 ms \u00b1 129 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().slice(start=1, stop=10, step=2))\n\nprint(df5.Name1.s_str().slice(start=1, stop=10, step=2))\n\nprint(df5.Name.str.slice(start=1, stop=10, step=2))\n\n%timeit -n 5 df5.Name2.s_str().slice(start=1, stop=10, step=2)\n\n%timeit -n 5 df5.Name1.s_str().slice(start=1, stop=10, step=2)\n\n%timeit -n 5 df5.Name.str.slice(start=1, stop=10, step=2)\n\n18.9 ms \u00b1 304 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n19.1 ms \u00b1 235 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n15.5 ms \u00b1 160 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().rfind(b'A'))\n\nprint(df5.Name1.s_str().rfind(b'A'))\n\nprint(df5.Name.str.rfind('A'))\n\n%timeit -n 5 df5.Name2.s_str().rfind(b'A')\n\n%timeit -n 5 df5.Name1.s_str().rfind(b'A')\n\n%timeit -n 5 df5.Name.str.rfind('A')\n\n41 ms \u00b1 618 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n41.2 ms \u00b1 301 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n35.2 ms \u00b1 216 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().startswith(b'Svensson, Mr. Johan'))\n\nprint(df5.Name1.s_str().startswith(b'Svensson, Mr. Johan'))\n\nprint(df5.Name.str.startswith('Svensson, Mr. Johan'))\n\n%timeit -n 5 df5.Name2.s_str().startswith(b'Svensson, Mr. Johan')\n\n%timeit -n 5 df5.Name1.s_str().startswith(b'Svensson, Mr. Johan')\n\n%timeit -n 5 df5.Name.str.startswith('Svensson, Mr. Johan')\n\n24.2 ms \u00b1 511 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n24.4 ms \u00b1 327 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n18.6 ms \u00b1 296 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().rjust(100))\n\nprint(df5.Name1.s_str().rjust(100))\n\nprint(df5.Name.str.rjust(100))\n\n%timeit -n 5 df5.Name2.s_str().rjust(100)\n\n%timeit -n 5 df5.Name1.s_str().rjust(100)\n\n%timeit -n 5 df5.Name.str.rjust(100)\n\n23.6 ms \u00b1 513 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n23.6 ms \u00b1 160 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n18.7 ms \u00b1 129 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().isdigit())\n\nprint(df5.Name1.s_str().isdigit())\n\nprint(df5.Name.str.isdigit())\n\n%timeit -n 5 df5.Name2.s_str().isdigit()\n\n%timeit -n 5 df5.Name1.s_str().isdigit()\n\n%timeit -n 5 df5.Name.str.isdigit()\n\n8.81 ms \u00b1 209 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n8.45 ms \u00b1 94 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n8.34 ms \u00b1 77.4 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().rstrip(b'A'))\n\nprint(df5.Name1.s_str().rstrip(b'A'))\n\nprint(df5.Name.str.rstrip('A'))\n\n%timeit -n 5 df5.Name2.s_str().rstrip(b'A')\n\n%timeit -n 5 df5.Name1.s_str().rstrip(b'A')\n\n%timeit -n 5 df5.Name.str.rstrip('A')\n\n17.5 ms \u00b1 598 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n17.2 ms \u00b1 208 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n11.9 ms \u00b1 159 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().rsplit(b'A'))\n\nprint(df5.Name1.s_str().rsplit(b'A'))\n\nprint(df5.Name.str.rsplit('A'))\n\n%timeit -n 5 df5.Name2.s_str().rsplit(b'A')\n\n%timeit -n 5 df5.Name1.s_str().rsplit(b'A')\n\n%timeit -n 5 df5.Name.str.rsplit('A')\n\n29 ms \u00b1 700 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n29.2 ms \u00b1 338 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n22.9 ms \u00b1 215 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().rstrip(b'A'))\n\nprint(df5.Name1.s_str().rstrip(b'A'))\n\nprint(df5.Name.str.rstrip('A'))\n\n%timeit -n 5 df5.Name2.s_str().rstrip(b'A')\n\n%timeit -n 5 df5.Name1.s_str().rstrip(b'A')\n\n%timeit -n 5 df5.Name.str.rstrip('A')\n\n17.3 ms \u00b1 441 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n17.3 ms \u00b1 217 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n12.1 ms \u00b1 132 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().match(b'zz'))\n\nprint(df5.Name1.s_str().match(b'zz'))\n\nprint(df5.Name.str.match('zz'))\n\n%timeit -n 5 df5.Name2.s_str().match(b'zz')\n\n%timeit -n 5 df5.Name1.s_str().match(b'zz')\n\n%timeit -n 5 df5.Name.str.match('zz')\n\n33.6 ms \u00b1 718 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n32.6 ms \u00b1 187 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n26.9 ms \u00b1 286 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().lstrip(b'zz'))\n\nprint(df5.Name1.s_str().lstrip(b'zz'))\n\nprint(df5.Name.str.lstrip('zz'))\n\n%timeit -n 5 df5.Name2.s_str().lstrip(b'zz')\n\n%timeit -n 5 df5.Name1.s_str().lstrip(b'zz')\n\n%timeit -n 5 df5.Name.str.lstrip('zz')\n\n17.5 ms \u00b1 447 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n17 ms \u00b1 178 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n11.8 ms \u00b1 98.1 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().lower())\n\nprint(df5.Name1.s_str().lower())\n\nprint(df5.Name.str.lower())\n\n%timeit -n 5 df5.Name2.s_str().lower()\n\n%timeit -n 5 df5.Name1.s_str().lower()\n\n%timeit -n 5 df5.Name.str.lower()\n\n13.5 ms \u00b1 224 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n13.3 ms \u00b1 168 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n11.9 ms \u00b1 582 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().ljust(100))\n\nprint(df5.Name1.s_str().ljust(100))\n\nprint(df5.Name.str.ljust(100))\n\n%timeit -n 5 df5.Name2.s_str().ljust(100)\n\n%timeit -n 5 df5.Name1.s_str().ljust(100)\n\n%timeit -n 5 df5.Name.str.ljust(100)\n\n24.1 ms \u00b1 540 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n23.8 ms \u00b1 144 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n19.7 ms \u00b1 146 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().removesuffix(b'A'))\n\nprint(df5.Name1.s_str().removesuffix(b'A'))\n\nprint(df5.Name.str.removesuffix('A'))\n\n%timeit -n 5 df5.Name2.s_str().removesuffix(b'A')\n\n%timeit -n 5 df5.Name1.s_str().removesuffix(b'A')\n\n%timeit -n 5 df5.Name.str.removesuffix('A')\n\n22.2 ms \u00b1 672 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n22.2 ms \u00b1 322 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n16.4 ms \u00b1 86.2 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().len())\n\nprint(df5.Name1.s_str().len())\n\nprint(df5.Name.str.len())\n\n%timeit -n 5 df5.Name2.s_str().len()\n\n%timeit -n 5 df5.Name1.s_str().len()\n\n%timeit -n 5 df5.Name.str.len()\n\n24 ms \u00b1 500 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n23.7 ms \u00b1 275 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n17.8 ms \u00b1 121 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().fullmatch(rb'(a\\w{3})(\\w+)'))\n\nprint(df5.Name1.s_str().fullmatch(rb'(a\\w{3})(\\w+)'))\n\nprint(df5.Name.str.fullmatch(r'(a\\w{3})(\\w+)'))\n\n%timeit -n 5 df5.Name2.s_str().fullmatch(rb'(a\\w{3})(\\w+)')\n\n%timeit -n 5 df5.Name1.s_str().fullmatch(rb'(a\\w{3})(\\w+)')\n\n%timeit -n 5 df5.Name.str.fullmatch(r'(a\\w{3})(\\w+)')\n\n29.3 ms \u00b1 470 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n29.3 ms \u00b1 330 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n23.9 ms \u00b1 385 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().findall(rb'(a\\w{3})(\\w+)'))\n\nprint(df5.Name1.s_str().findall(rb'(a\\w{3})(\\w+)'))\n\nprint(df5.Name.str.findall(r'(a\\w{3})(\\w+)'))\n\n%timeit -n 5 df5.Name2.s_str().findall(rb'(a\\w{3})(\\w+)')\n\n%timeit -n 5 df5.Name1.s_str().findall(rb'(a\\w{3})(\\w+)')\n\n%timeit -n 5 df5.Name.str.findall(r'(a\\w{3})(\\w+)')\n\n42.8 ms \u00b1 411 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n43.2 ms \u00b1 506 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n39.5 ms \u00b1 314 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().find(rb'(a\\w{3})(\\w+)'))\n\nprint(df5.Name1.s_str().find(rb'(a\\w{3})(\\w+)'))\n\nprint(df5.Name.str.find(r'(a\\w{3})(\\w+)'))\n\n%timeit -n 5 df5.Name2.s_str().find(rb'(a\\w{3})(\\w+)')\n\n%timeit -n 5 df5.Name1.s_str().find(rb'(a\\w{3})(\\w+)')\n\n%timeit -n 5 df5.Name.str.find(r'(a\\w{3})(\\w+)')\n\n40.5 ms \u00b1 641 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n40.4 ms \u00b1 175 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n34.5 ms \u00b1 231 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().extractall(rb'(a\\w{3})(\\w+)'))\n\nprint(df5.Name1.s_str().extractall(rb'(a\\w{3})(\\w+)'))\n\nprint(df5.Name.str.extractall(r'(a\\w{3})(\\w+)'))\n\n%timeit -n 5 df5.Name2.s_str().extractall(rb'(a\\w{3})(\\w+)')\n\n%timeit -n 5 df5.Name1.s_str().extractall(rb'(a\\w{3})(\\w+)')\n\n%timeit -n 5 df5.Name.str.extractall(r'(a\\w{3})(\\w+)')\n\n165 ms \u00b1 439 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n167 ms \u00b1 346 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n156 ms \u00b1 308 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().extract(rb'(a\\w{3})'))\n\nprint(df5.Name1.s_str().extract(rb'(a\\w{3})'))\n\nprint(df5.Name.str.extract(r'(a\\w{3})'))\n\n%timeit -n 5 df5.Name2.s_str().extract(rb'(a\\w{3})')\n\n%timeit -n 5 df5.Name1.s_str().extract(rb'(a\\w{3})')\n\n%timeit -n 5 df5.Name.str.extract(r'(a\\w{3})')\n\n64.7 ms \u00b1 699 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n63.7 ms \u00b1 343 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n55.8 ms \u00b1 352 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().endswith(b'a'))\n\nprint(df5.Name1.s_str().endswith(b'a'))\n\nprint(df5.Name.str.endswith('a'))\n\n%timeit -n 5 df5.Name2.s_str().endswith(b'a')\n\n%timeit -n 5 df5.Name1.s_str().endswith(b'a')\n\n%timeit -n 5 df5.Name.str.endswith('a')\n\n24.4 ms \u00b1 800 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n23.9 ms \u00b1 97.7 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n18.2 ms \u00b1 160 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().count(re.compile(b'a+')))\n\nprint(df5.Name1.s_str().count(re.compile(b'a+')))\n\nprint(df5.Name.str.count(re.compile('a+')))\n\n%timeit -n 5 df5.Name2.s_str().count(re.compile(b'a+'))\n\n%timeit -n 5 df5.Name1.s_str().count(re.compile(b'a+'))\n\n%timeit -n 5 df5.Name.str.count(re.compile('a+'))\n\n88.5 ms \u00b1 407 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n94.7 ms \u00b1 280 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n83.4 ms \u00b1 238 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().zfill(100))\n\nprint(df5.Name1.s_str().zfill(100))\n\nprint(df5.Name.str.zfill(100))\n\n%timeit -n 5 df5.Name2.s_str().zfill(100)\n\n%timeit -n 5 df5.Name1.s_str().zfill(100)\n\n%timeit -n 5 df5.Name.str.zfill(100)\n\n22.9 ms \u00b1 369 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n22.5 ms \u00b1 216 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n17.9 ms \u00b1 80.3 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().contains(b'a'))\n\nprint(df5.Name1.s_str().contains(b'a'))\n\nprint(df5.Name.str.contains('a'))\n\n%timeit -n 5 df5.Name2.s_str().contains(b'a')\n\n%timeit -n 5 df5.Name1.s_str().contains(b'a')\n\n%timeit -n 5 df5.Name.str.contains('a')\n\n30.5 ms \u00b1 551 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n30.5 ms \u00b1 287 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n24.4 ms \u00b1 249 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().pad(width=100, side='both', fillchar=b'-'))\n\nprint(df5.Name1.s_str().pad(width=100, side='both', fillchar=b'-'))\n\nprint(df5.Name.str.pad(width=100, side='both', fillchar='-'))\n\n%timeit -n 5 df5.Name2.s_str().pad(width=100, side='both', fillchar=b'-')\n\n%timeit -n 5 df5.Name1.s_str().pad(width=100, side='both', fillchar=b'-')\n\n%timeit -n 5 df5.Name.str.pad(width=100, side='both', fillchar='-')\n\n23.9 ms \u00b1 579 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n24.2 ms \u00b1 411 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n19.5 ms \u00b1 77.7 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().center(width=5))\n\nprint(df5.Name1.s_str().center(width=5))\n\nprint(df5.Name.str.center(width=5))\n\n%timeit -n 5 df5.Name2.s_str().center(width=5)\n\n%timeit -n 5 df5.Name1.s_str().center(width=5)\n\n%timeit -n 5 df5.Name.str.center(width=5)\n\n17.7 ms \u00b1 368 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n18 ms \u00b1 327 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n12.5 ms \u00b1 75.7 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n```\n\n\n\n## Methods much slower than Series.str\n\n\n\n```python\n\nprint(df5.Name2.s_str().cat())\n\nprint(df5.Name1.s_str().cat())\n\nprint(df5.Name.str.cat())\n\n%timeit -n 5 df5.Name2.s_str().cat()\n\n%timeit -n 5 df5.Name1.s_str().cat()\n\n%timeit -n 5 df5.Name.str.cat()\n\n14.1 ms \u00b1 706 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n13.9 ms \u00b1 877 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n3.74 ms \u00b1 17.6 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().casefold())\n\nprint(df5.Name1.s_str().casefold())\n\nprint(df5.Name.str.casefold())\n\n%timeit -n 5 df5.Name2.s_str().casefold()\n\n%timeit -n 5 df5.Name1.s_str().casefold()\n\n%timeit -n 5 df5.Name.str.casefold()\n\n168 ms \u00b1 556 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n200 ms \u00b1 466 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n11.5 ms \u00b1 115 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().join(b'zz'))\n\nprint(df5.Name1.s_str().join(b'zz'))\n\nprint(df5.Name.str.join('zz'))\n\n%timeit -n 5 df5.Name2.s_str().join(b'zz')\n\n%timeit -n 5 df5.Name1.s_str().join(b'zz')\n\n%timeit -n 5 df5.Name.str.join('zz')\n\n360 ms \u00b1 2.22 ms per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n366 ms \u00b1 514 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n54 ms \u00b1 271 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().normalize(form='NFC'))\n\nprint(df5.Name1.s_str().normalize(form='NFC'))\n\nprint(df5.Name.str.normalize(form='NFC'))\n\n%timeit -n 5 df5.Name2.s_str().normalize(form='NFC')\n\n%timeit -n 5 df5.Name1.s_str().normalize(form='NFC')\n\n%timeit -n 5 df5.Name.str.normalize(form='NFC')\n\n173 ms \u00b1 892 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n189 ms \u00b1 688 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n17.7 ms \u00b1 127 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().wrap(10))\n\nprint(df5.Name1.s_str().wrap(10))\n\nprint(df5.Name.str.wrap(10))\n\n%timeit -n 5 df5.Name2.s_str().wrap(10)\n\n%timeit -n 5 df5.Name1.s_str().wrap(10)\n\n%timeit -n 5 df5.Name.str.wrap(10)\n\n1.48 s \u00b1 67.7 ms per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n1.55 s \u00b1 25.5 ms per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n899 ms \u00b1 1.11 ms per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n#################################################################\n\nprint(df5.Name2.s_str().get(1))\n\nprint(df5.Name1.s_str().get(1))\n\nprint(df5.Name.str.get(1))\n\n%timeit -n 5 df5.Name2.s_str().get(1)\n\n%timeit -n 5 df5.Name1.s_str().get(1)\n\n%timeit -n 5 df5.Name.str.get(1)\n\n45 ms \u00b1 604 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n44.8 ms \u00b1 294 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n24.5 ms \u00b1 644 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 5 loops each)\n\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Up to 25 times faster than df.loc by combining np.select and numexpr.evaluate (works with utf-8)",
    "version": "0.11",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/a_pandas_ex_fastloc"
    },
    "split_keywords": [
        "numexpr",
        "numpy",
        "loc",
        "iloc",
        "pandas",
        "series"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "016c7625dfe24d2580d49c064e231aad58e5658d736341fc08e2b0751248746f",
                "md5": "bde631084101874f144d01daace45b4b",
                "sha256": "1e40e71961731d9d85813ba428fa0becdbb8a6a5dd3224da9990e1b353d6a03d"
            },
            "downloads": -1,
            "filename": "a_pandas_ex_fastloc-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bde631084101874f144d01daace45b4b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 46269,
            "upload_time": "2023-02-05T03:14:33",
            "upload_time_iso_8601": "2023-02-05T03:14:33.799156Z",
            "url": "https://files.pythonhosted.org/packages/01/6c/7625dfe24d2580d49c064e231aad58e5658d736341fc08e2b0751248746f/a_pandas_ex_fastloc-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e758e82d9b7dd8848857bd660f98c349583f84c3593e33f70cd7f7be8e448b63",
                "md5": "95439cb577f7d3e750df8b28de1edeff",
                "sha256": "83b937953fc187587665a40af35a2df51ee2c768524258a698b9be42dc6b171e"
            },
            "downloads": -1,
            "filename": "a_pandas_ex_fastloc-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "95439cb577f7d3e750df8b28de1edeff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 60453,
            "upload_time": "2023-02-05T03:14:36",
            "upload_time_iso_8601": "2023-02-05T03:14:36.691525Z",
            "url": "https://files.pythonhosted.org/packages/e7/58/e82d9b7dd8848857bd660f98c349583f84c3593e33f70cd7f7be8e448b63/a_pandas_ex_fastloc-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-05 03:14:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "a_pandas_ex_fastloc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "numexpr",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "regex",
            "specs": []
        },
        {
            "name": "ujson",
            "specs": []
        }
    ],
    "lcname": "a-pandas-ex-fastloc"
}
        
Elapsed time: 0.42037s