Package: a-pandas-ex-split-on-common-char
Splits the elements in a Series using a common separator character and returns a DataFrame.Tested against Windows 10 / Python 3.11 / Anacondapip install a-pandas-ex-split-on-common-charParameters:-----------self:SeriesTheinputSeriescontainingstringstobesplit.sepstring:str,optionalTheseparatorstringtosplittheelementsby(defaultisasinglespace).len_tolerance:int,optionalMinimumlengthofresultingstringstobeconsideredvalid(defaultis0).Returns:--------pandas.DataFrameADataFramecontainingthesplitelementsfromtheSeries.stringtosplit='''unix  2      [ ]         DGRAM                       13449 -                  /data/system/unsolzygotesocketunix  2      [ ACC ]     STREAM     LISTENING        13019 -                  /data/system/ndebugsocketunix  2      [ ACC ]     STREAM     LISTENING        13104 -                  @com.android.internal.os.WebViewZygoteInit/58dbfcdc-c54c-4201-81c2-9cc331e5aff8unix  2      [ ACC ]     STREAM     LISTENING        20451 -                  @com.android.internal.os.AppZygoteInit/2da63555-2b8e-4593-b42c-6386b4d36f59unix  2      [ ACC ]     STREAM     LISTENING         8276 -                  /dev/socket/property_serviceunix  2      [ ACC ]     STREAM     LISTENING         8556 -                  /dev/socket/logdunix  2      [ ACC ]     SEQPACKET  LISTENING         8558 -                  /dev/socket/logdrunix  83     [ ]         DGRAM                        8560 -                  /dev/socket/logdwunix  2      [ ACC ]     SEQPACKET  LISTENING         8563 -                  /dev/socket/lmkdunix  2      [ ACC ]     SEQPACKET  LISTENING         8838 -                  /dev/socket/tombstoned_crashunix  2      [ ACC ]     SEQPACKET  LISTENING         8840 -                  /dev/socket/tombstoned_interceptunix  2      [ ACC ]     SEQPACKET  LISTENING         8842 -                  /dev/socket/tombstoned_java_traceunix  22     [ ]         DGRAM                        8889 -                  /dev/socket/statsdwunix  2      [ ACC ]     STREAM     LISTENING         8892 -                  /dev/socket/dnsproxydunix  2      [ ACC ]     STREAM     LISTENING         8894 -                  /dev/socket/mdnsunix  2      [ ACC ]     STREAM     LISTENING         8896 -                  /dev/socket/fwmarkdunix  2      [ ACC ]     STREAM     LISTENING         8899 -                  /dev/socket/zygoteunix  2      [ ACC ]     STREAM     LISTENING         8901 -                  /dev/socket/usap_pool_primaryunix  2      [ ACC ]     STREAM     LISTENING         8904 -                  /dev/socket/zygote_secondaryunix  2      [ ACC ]     STREAM     LISTENING         8906 -                  /dev/socket/usap_pool_secondaryunix  2      [ ACC ]     STREAM     LISTENING         9937 -                  /dev/socket/mdnsdunix  2      [ ACC ]     STREAM     LISTENING         9941 -                  /dev/socket/traced_consumerunix  2      [ ACC ]     STREAM     LISTENING         9943 -                  /dev/socket/traced_producerunix  2      [ ACC ]     SEQPACKET  LISTENING        10879 -                  @jdwp-controlunix  2      [ ACC ]     SEQPACKET  LISTENING        10488 -                  /dev/socket/adbdunix  2      [ ]         DGRAM                       21149 -unix  3      [ ]         STREAM     CONNECTED        12840 -                  /dev/socket/zygoteunix  3      [ ]         STREAM     CONNECTED        20457 -                  @com.android.internal.os.AppZygoteInit/2da63555-2b8e-4593-b42c-6386b4d36f59unix  3      [ ]         SEQPACKET  CONNECTED        21156 -unix  3      [ ]         SEQPACKET  CONNECTED        16570 -unix  2      [ ]         DGRAM                       13698 -unix  3      [ ]         SEQPACKET  CONNECTED        13012 -                  @jdwp-controlunix  2      [ ]         DGRAM                       11680 -unix  3      [ ]         SEQPACKET  CONNECTED        25569 -unix  3      [ ]         SEQPACKET  CONNECTED        25208 -unix  3      [ ]         STREAM     CONNECTED        20456 -unix  2      [ ]         DGRAM                       16746 -unix  3      [ ]         STREAM     CONNECTED        39851 -unix  2      [ ]         DGRAM                       11550 -unix  2      [ ]         DGRAM                        9804 -unix  2      [ ]         DGRAM                       10301 -unix  3      [ ]         SEQPACKET  CONNECTED        27528 -unix  3      [ ]         SEQPACKET  CONNECTED        20653 -unix  2      [ ]         DGRAM                        8075 -unix  2      [ ]         DGRAM                       10131 -unix  3      [ ]         SEQPACKET  CONNECTED        16077 -unix  3      [ ]         SEQPACKET  CONNECTED        15948 -unix  3      [ ]         SEQPACKET  CONNECTED        12462 -                  /dev/socket/logdrunix  3      [ ]         SEQPACKET  CONNECTED        35988 -unix  2      [ ]         DGRAM                       11571 -unix  3      [ ]         SEQPACKET  CONNECTED        16759 -unix  3      [ ]         SEQPACKET  CONNECTED        13514 -unix  2      [ ]         DGRAM                       26323 -unix  3      [ ]         STREAM     CONNECTED        19740 -unix  3      [ ]         SEQPACKET  CONNECTED        19600 -                  @jdwp-controlunix  3      [ ]         STREAM     CONNECTED         9918 -unix  3      [ ]         SEQPACKET  CONNECTED        16585 -                  @jdwp-controlunix  3      [ ]         SEQPACKET  CONNECTED        11710 -'''froma_pandas_ex_split_on_common_charimportpd_add_split_on_common_charpd_add_split_on_common_char()df=pd.DataFrame(stringtosplit.strip().splitlines())df2=df[0].s_split_on_common_char(sepstring=" ",len_tolerance=0)df3=df[0].s_split_on_common_char(sepstring="[",len_tolerance=0)df4=df[0].s_split_on_common_char(sepstring="]",len_tolerance=25)# df# Out[6]:#                                                     0# 0   unix  2      [ ]         DGRAM                ...# 1   unix  2      [ ACC ]     STREAM     LISTENING ...# 2   unix  2      [ ACC ]     STREAM     LISTENING ...# 3   unix  2      [ ACC ]     STREAM     LISTENING ...# 4   unix  2      [ ACC ]     STREAM     LISTENING ...# 5   unix  2      [ ACC ]     STREAM     LISTENING ...# 6   unix  2      [ ACC ]     SEQPACKET  LISTENING ...# 7   unix  83     [ ]         DGRAM                ...# 8   unix  2      [ ACC ]     SEQPACKET  LISTENING ...# 9   unix  2      [ ACC ]     SEQPACKET  LISTENING ...# 10  unix  2      [ ACC ]     SEQPACKET  LISTENING ...# 11  unix  2      [ ACC ]     SEQPACKET  LISTENING ...# 12  unix  22     [ ]         DGRAM                ...# 13  unix  2      [ ACC ]     STREAM     LISTENING ...# 14  unix  2      [ ACC ]     STREAM     LISTENING ...# 15  unix  2      [ ACC ]     STREAM     LISTENING ...# 16  unix  2      [ ACC ]     STREAM     LISTENING ...# 17  unix  2      [ ACC ]     STREAM     LISTENING ...# 18  unix  2      [ ACC ]     STREAM     LISTENING ...# 19  unix  2      [ ACC ]     STREAM     LISTENING ...# 20  unix  2      [ ACC ]     STREAM     LISTENING ...# 21  unix  2      [ ACC ]     STREAM     LISTENING ...# 22  unix  2      [ ACC ]     STREAM     LISTENING ...# 23  unix  2      [ ACC ]     SEQPACKET  LISTENING ...# 24  unix  2      [ ACC ]     SEQPACKET  LISTENING ...# 25  unix  2      [ ]         DGRAM                ...# 26  unix  3      [ ]         STREAM     CONNECTED ...# 27  unix  3      [ ]         STREAM     CONNECTED ...# 28  unix  3      [ ]         SEQPACKET  CONNECTED ...# 29  unix  3      [ ]         SEQPACKET  CONNECTED ...# 30  unix  2      [ ]         DGRAM                ...# 31  unix  3      [ ]         SEQPACKET  CONNECTED ...# 32  unix  2      [ ]         DGRAM                ...# 33  unix  3      [ ]         SEQPACKET  CONNECTED ...# 34  unix  3      [ ]         SEQPACKET  CONNECTED ...# 35  unix  3      [ ]         STREAM     CONNECTED ...# 36  unix  2      [ ]         DGRAM                ...# 37  unix  3      [ ]         STREAM     CONNECTED ...# 38  unix  2      [ ]         DGRAM                ...# 39  unix  2      [ ]         DGRAM                ...# 40  unix  2      [ ]         DGRAM                ...# 41  unix  3      [ ]         SEQPACKET  CONNECTED ...# 42  unix  3      [ ]         SEQPACKET  CONNECTED ...# 43  unix  2      [ ]         DGRAM                ...# 44  unix  2      [ ]         DGRAM                ...# 45  unix  3      [ ]         SEQPACKET  CONNECTED ...# 46  unix  3      [ ]         SEQPACKET  CONNECTED ...# 47  unix  3      [ ]         SEQPACKET  CONNECTED ...# 48  unix  3      [ ]         SEQPACKET  CONNECTED ...# 49  unix  2      [ ]         DGRAM                ...# 50  unix  3      [ ]         SEQPACKET  CONNECTED ...# 51  unix  3      [ ]         SEQPACKET  CONNECTED ...# 52  unix  2      [ ]         DGRAM                ...# 53  unix  3      [ ]         STREAM     CONNECTED ...# 54  unix  3      [ ]         SEQPACKET  CONNECTED ...# 55  unix  3      [ ]         STREAM     CONNECTED ...# 56  unix  3      [ ]         SEQPACKET  CONNECTED ...# 57  unix  3      [ ]         SEQPACKET  CONNECTED ...# df2# Out[7]:#        0    1   2  ...       7   8                                                 9# 0   unix   2    [  ...   13449   -                    /data/system/unsolzygotesocket# 1   unix   2    [  ...   13019   -                         /data/system/ndebugsocket# 2   unix   2    [  ...   13104   -                    @com.android.internal.os.WebVi# 3   unix   2    [  ...   20451   -                    @com.android.internal.os.AppZy# 4   unix   2    [  ...    8276   -                      /dev/socket/property_service# 5   unix   2    [  ...    8556   -                                  /dev/socket/logd# 6   unix   2    [  ...    8558   -                                 /dev/socket/logdr# 7   unix   83   [  ...    8560   -                                 /dev/socket/logdw# 8   unix   2    [  ...    8563   -                                  /dev/socket/lmkd# 9   unix   2    [  ...    8838   -                      /dev/socket/tombstoned_crash# 10  unix   2    [  ...    8840   -                    /dev/socket/tombstoned_interce# 11  unix   2    [  ...    8842   -                    /dev/socket/tombstoned_java_tr# 12  unix   22   [  ...    8889   -                               /dev/socket/statsdw# 13  unix   2    [  ...    8892   -                             /dev/socket/dnsproxyd# 14  unix   2    [  ...    8894   -                                  /dev/socket/mdns# 15  unix   2    [  ...    8896   -                               /dev/socket/fwmarkd# 16  unix   2    [  ...    8899   -                                /dev/socket/zygote# 17  unix   2    [  ...    8901   -                     /dev/socket/usap_pool_primary# 18  unix   2    [  ...    8904   -                      /dev/socket/zygote_secondary# 19  unix   2    [  ...    8906   -                    /dev/socket/usap_pool_secondar# 20  unix   2    [  ...    9937   -                                 /dev/socket/mdnsd# 21  unix   2    [  ...    9941   -                       /dev/socket/traced_consumer# 22  unix   2    [  ...    9943   -                       /dev/socket/traced_producer# 23  unix   2    [  ...   10879   -                                     @jdwp-control# 24  unix   2    [  ...   10488   -                                  /dev/socket/adbd# 25  unix   2    [  ...   21149   -# 26  unix   3    [  ...   12840   -                                /dev/socket/zygote# 27  unix   3    [  ...   20457   -                    @com.android.internal.os.AppZy# 28  unix   3    [  ...   21156   -# 29  unix   3    [  ...   16570   -# 30  unix   2    [  ...   13698   -# 31  unix   3    [  ...   13012   -                                     @jdwp-control# 32  unix   2    [  ...   11680   -# 33  unix   3    [  ...   25569   -# 34  unix   3    [  ...   25208   -# 35  unix   3    [  ...   20456   -# 36  unix   2    [  ...   16746   -# 37  unix   3    [  ...   39851   -# 38  unix   2    [  ...   11550   -# 39  unix   2    [  ...    9804   -# 40  unix   2    [  ...   10301   -# 41  unix   3    [  ...   27528   -# 42  unix   3    [  ...   20653   -# 43  unix   2    [  ...    8075   -# 44  unix   2    [  ...   10131   -# 45  unix   3    [  ...   16077   -# 46  unix   3    [  ...   15948   -# 47  unix   3    [  ...   12462   -                                 /dev/socket/logdr# 48  unix   3    [  ...   35988   -# 49  unix   2    [  ...   11571   -# 50  unix   3    [  ...   16759   -# 51  unix   3    [  ...   13514   -# 52  unix   2    [  ...   26323   -# 53  unix   3    [  ...   19740   -# 54  unix   3    [  ...   19600   -                                     @jdwp-control# 55  unix   3    [  ...    9918   -# 56  unix   3    [  ...   16585   -                                     @jdwp-control# 57  unix   3    [  ...   11710   -# [58 rows x 10 columns]# df3# Out[8]:#                 0                                                  1# 0   unix  2        [ ]         DGRAM                       13449 ...# 1   unix  2        [ ACC ]     STREAM     LISTENING        13019 ...# 2   unix  2        [ ACC ]     STREAM     LISTENING        13104 ...# 3   unix  2        [ ACC ]     STREAM     LISTENING        20451 ...# 4   unix  2        [ ACC ]     STREAM     LISTENING         8276 ...# 5   unix  2        [ ACC ]     STREAM     LISTENING         8556 ...# 6   unix  2        [ ACC ]     SEQPACKET  LISTENING         8558 ...# 7   unix  83       [ ]         DGRAM                        8560 ...# 8   unix  2        [ ACC ]     SEQPACKET  LISTENING         8563 ...# 9   unix  2        [ ACC ]     SEQPACKET  LISTENING         8838 ...# 10  unix  2        [ ACC ]     SEQPACKET  LISTENING         8840 ...# 11  unix  2        [ ACC ]     SEQPACKET  LISTENING         8842 ...# 12  unix  22       [ ]         DGRAM                        8889 ...# 13  unix  2        [ ACC ]     STREAM     LISTENING         8892 ...# 14  unix  2        [ ACC ]     STREAM     LISTENING         8894 ...# 15  unix  2        [ ACC ]     STREAM     LISTENING         8896 ...# 16  unix  2        [ ACC ]     STREAM     LISTENING         8899 ...# 17  unix  2        [ ACC ]     STREAM     LISTENING         8901 ...# 18  unix  2        [ ACC ]     STREAM     LISTENING         8904 ...# 19  unix  2        [ ACC ]     STREAM     LISTENING         8906 ...# 20  unix  2        [ ACC ]     STREAM     LISTENING         9937 ...# 21  unix  2        [ ACC ]     STREAM     LISTENING         9941 ...# 22  unix  2        [ ACC ]     STREAM     LISTENING         9943 ...# 23  unix  2        [ ACC ]     SEQPACKET  LISTENING        10879 ...# 24  unix  2        [ ACC ]     SEQPACKET  LISTENING        10488 ...# 25  unix  2        [ ]         DGRAM                       21149 ...# 26  unix  3        [ ]         STREAM     CONNECTED        12840 ...# 27  unix  3        [ ]         STREAM     CONNECTED        20457 ...# 28  unix  3        [ ]         SEQPACKET  CONNECTED        21156 ...# 29  unix  3        [ ]         SEQPACKET  CONNECTED        16570 ...# 30  unix  2        [ ]         DGRAM                       13698 ...# 31  unix  3        [ ]         SEQPACKET  CONNECTED        13012 ...# 32  unix  2        [ ]         DGRAM                       11680 ...# 33  unix  3        [ ]         SEQPACKET  CONNECTED        25569 ...# 34  unix  3        [ ]         SEQPACKET  CONNECTED        25208 ...# 35  unix  3        [ ]         STREAM     CONNECTED        20456 ...# 36  unix  2        [ ]         DGRAM                       16746 ...# 37  unix  3        [ ]         STREAM     CONNECTED        39851 ...# 38  unix  2        [ ]         DGRAM                       11550 ...# 39  unix  2        [ ]         DGRAM                        9804 ...# 40  unix  2        [ ]         DGRAM                       10301 ...# 41  unix  3        [ ]         SEQPACKET  CONNECTED        27528 ...# 42  unix  3        [ ]         SEQPACKET  CONNECTED        20653 ...# 43  unix  2        [ ]         DGRAM                        8075 ...# 44  unix  2        [ ]         DGRAM                       10131 ...# 45  unix  3        [ ]         SEQPACKET  CONNECTED        16077 ...# 46  unix  3        [ ]         SEQPACKET  CONNECTED        15948 ...# 47  unix  3        [ ]         SEQPACKET  CONNECTED        12462 ...# 48  unix  3        [ ]         SEQPACKET  CONNECTED        35988 ...# 49  unix  2        [ ]         DGRAM                       11571 ...# 50  unix  3        [ ]         SEQPACKET  CONNECTED        16759 ...# 51  unix  3        [ ]         SEQPACKET  CONNECTED        13514 ...# 52  unix  2        [ ]         DGRAM                       26323 ...# 53  unix  3        [ ]         STREAM     CONNECTED        19740 ...# 54  unix  3        [ ]         SEQPACKET  CONNECTED        19600 ...# 55  unix  3        [ ]         STREAM     CONNECTED         9918 ...# 56  unix  3        [ ]         SEQPACKET  CONNECTED        16585 ...# 57  unix  3          [ ]         SEQPACKET  CONNECTED        11710 -# df4# Out[9]:#                   0                                                  1# 0   unix  2      [   ]         DGRAM                       13449 - ...# 1   unix  2      [   ACC ]     STREAM     LISTENING        13019 - ...# 2   unix  2      [   ACC ]     STREAM     LISTENING        13104 - ...# 3   unix  2      [   ACC ]     STREAM     LISTENING        20451 - ...# 4   unix  2      [   ACC ]     STREAM     LISTENING         8276 - ...# 5   unix  2      [   ACC ]     STREAM     LISTENING         8556 - ...# 6   unix  2      [   ACC ]     SEQPACKET  LISTENING         8558 - ...# 7   unix  83     [   ]         DGRAM                        8560 - ...# 8   unix  2      [   ACC ]     SEQPACKET  LISTENING         8563 - ...# 9   unix  2      [   ACC ]     SEQPACKET  LISTENING         8838 - ...# 10  unix  2      [   ACC ]     SEQPACKET  LISTENING         8840 - ...# 11  unix  2      [   ACC ]     SEQPACKET  LISTENING         8842 - ...# 12  unix  22     [   ]         DGRAM                        8889 - ...# 13  unix  2      [   ACC ]     STREAM     LISTENING         8892 - ...# 14  unix  2      [   ACC ]     STREAM     LISTENING         8894 - ...# 15  unix  2      [   ACC ]     STREAM     LISTENING         8896 - ...# 16  unix  2      [   ACC ]     STREAM     LISTENING         8899 - ...# 17  unix  2      [   ACC ]     STREAM     LISTENING         8901 - ...# 18  unix  2      [   ACC ]     STREAM     LISTENING         8904 - ...# 19  unix  2      [   ACC ]     STREAM     LISTENING         8906 - ...# 20  unix  2      [   ACC ]     STREAM     LISTENING         9937 - ...# 21  unix  2      [   ACC ]     STREAM     LISTENING         9941 - ...# 22  unix  2      [   ACC ]     STREAM     LISTENING         9943 - ...# 23  unix  2      [   ACC ]     SEQPACKET  LISTENING        10879 - ...# 24  unix  2      [   ACC ]     SEQPACKET  LISTENING        10488 - ...# 25  unix  2      [   ]         DGRAM                       21149 - ...# 26  unix  3      [   ]         STREAM     CONNECTED        12840 - ...# 27  unix  3      [   ]         STREAM     CONNECTED        20457 - ...# 28  unix  3      [   ]         SEQPACKET  CONNECTED        21156 - ...# 29  unix  3      [   ]         SEQPACKET  CONNECTED        16570 - ...# 30  unix  2      [   ]         DGRAM                       13698 - ...# 31  unix  3      [   ]         SEQPACKET  CONNECTED        13012 - ...# 32  unix  2      [   ]         DGRAM                       11680 - ...# 33  unix  3      [   ]         SEQPACKET  CONNECTED        25569 - ...# 34  unix  3      [   ]         SEQPACKET  CONNECTED        25208 - ...# 35  unix  3      [   ]         STREAM     CONNECTED        20456 - ...# 36  unix  2      [   ]         DGRAM                       16746 - ...# 37  unix  3      [   ]         STREAM     CONNECTED        39851 - ...# 38  unix  2      [   ]         DGRAM                       11550 - ...# 39  unix  2      [   ]         DGRAM                        9804 - ...# 40  unix  2      [   ]         DGRAM                       10301 - ...# 41  unix  3      [   ]         SEQPACKET  CONNECTED        27528 - ...# 42  unix  3      [   ]         SEQPACKET  CONNECTED        20653 - ...# 43  unix  2      [   ]         DGRAM                        8075 - ...# 44  unix  2      [   ]         DGRAM                       10131 - ...# 45  unix  3      [   ]         SEQPACKET  CONNECTED        16077 - ...# 46  unix  3      [   ]         SEQPACKET  CONNECTED        15948 - ...# 47  unix  3      [   ]         SEQPACKET  CONNECTED        12462 - ...# 48  unix  3      [   ]         SEQPACKET  CONNECTED        35988 - ...# 49  unix  2      [   ]         DGRAM                       11571 - ...# 50  unix  3      [   ]         SEQPACKET  CONNECTED        16759 - ...# 51  unix  3      [   ]         SEQPACKET  CONNECTED        13514 - ...# 52  unix  2      [   ]         DGRAM                       26323 - ...# 53  unix  3      [   ]         STREAM     CONNECTED        19740 - ...# 54  unix  3      [   ]         SEQPACKET  CONNECTED        19600 - ...# 55  unix  3      [   ]         STREAM     CONNECTED         9918 - ...# 56  unix  3      [   ]         SEQPACKET  CONNECTED        16585 - ...# 57  unix  3      [       ]         SEQPACKET  CONNECTED        11710 -