nes | NES emulator written in Go | Video Game library

 by   fogleman Go Version: Current License: MIT

kandi X-RAY | nes Summary

nes is a Go library typically used in Gaming, Video Game applications. nes has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.
This is an NES emulator written in Go.
    Support
      Quality
        Security
          License
            Reuse
            Support
              Quality
                Security
                  License
                    Reuse

                      kandi-support Support

                        summary
                        nes has a medium active ecosystem.
                        summary
                        It has 5165 star(s) with 495 fork(s). There are 145 watchers for this library.
                        summary
                        It had no major release in the last 6 months.
                        summary
                        There are 7 open issues and 26 have been closed. On average issues are closed in 48 days. There are 3 open pull requests and 0 closed requests.
                        summary
                        It has a neutral sentiment in the developer community.
                        summary
                        The latest version of nes is current.
                        nes Support
                          Best in #Video Game
                            Average in #Video Game
                            nes Support
                              Best in #Video Game
                                Average in #Video Game

                                  kandi-Quality Quality

                                    summary
                                    nes has 0 bugs and 0 code smells.
                                    nes Quality
                                      Best in #Video Game
                                        Average in #Video Game
                                        nes Quality
                                          Best in #Video Game
                                            Average in #Video Game

                                              kandi-Security Security

                                                summary
                                                nes has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
                                                summary
                                                nes code analysis shows 0 unresolved vulnerabilities.
                                                summary
                                                There are 0 security hotspots that need review.
                                                nes Security
                                                  Best in #Video Game
                                                    Average in #Video Game
                                                    nes Security
                                                      Best in #Video Game
                                                        Average in #Video Game

                                                          kandi-License License

                                                            summary
                                                            nes is licensed under the MIT License. This license is Permissive.
                                                            summary
                                                            Permissive licenses have the least restrictions, and you can use them in most projects.
                                                            nes License
                                                              Best in #Video Game
                                                                Average in #Video Game
                                                                nes License
                                                                  Best in #Video Game
                                                                    Average in #Video Game

                                                                      kandi-Reuse Reuse

                                                                        summary
                                                                        nes releases are not available. You will need to build from source code and install.
                                                                        summary
                                                                        Installation instructions, examples and code snippets are available.
                                                                        summary
                                                                        It has 4468 lines of code, 375 functions and 28 files.
                                                                        summary
                                                                        It has high code complexity. Code complexity directly impacts maintainability of the code.
                                                                        nes Reuse
                                                                          Best in #Video Game
                                                                            Average in #Video Game
                                                                            nes Reuse
                                                                              Best in #Video Game
                                                                                Average in #Video Game
                                                                                  Top functions reviewed by kandi - BETA
                                                                                  kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
                                                                                  Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here
                                                                                  Get all kandi verified functions for this library.
                                                                                  Get all kandi verified functions for this library.

                                                                                  nes Key Features

                                                                                  NES emulator written in Go.

                                                                                  nes Examples and Code Snippets

                                                                                  No Code Snippets are available at this moment for nes.
                                                                                  Community Discussions

                                                                                  Trending Discussions on nes

                                                                                  I can't install nestjs in ubuntu 20.04
                                                                                  chevron right
                                                                                  Extract first element from all list of tuples in a row-wise manner in pandas dataframe
                                                                                  chevron right
                                                                                  Error ' not supported between instances of float and str ' when I try to use .sort() on a Python list
                                                                                  chevron right
                                                                                  How can pathlib read_text() method display German Umlaute correctly on Windows 10 Enterprise?
                                                                                  chevron right
                                                                                  Python f.seek and string slice yields different results
                                                                                  chevron right
                                                                                  JS regex to match zero-width position either loops forever or doesn't match at all
                                                                                  chevron right
                                                                                  Problem installing nes-py in WSL ubuntu using conda
                                                                                  chevron right
                                                                                  Plotting hhmm (int) format time data on matplotlib polar graph
                                                                                  chevron right
                                                                                  Can this conditional be shortened?
                                                                                  chevron right
                                                                                  Getting Netlify build error when importing web3 in NextJS application - 'Error: Can't resolve 'electron' in...'
                                                                                  chevron right

                                                                                  QUESTION

                                                                                  I can't install nestjs in ubuntu 20.04
                                                                                  Asked 2022-Apr-04 at 11:32

                                                                                  I'm using Ubuntu 20.04 LTS and I was trying to install nestjs to study but... well, it's better to show what happened

                                                                                  first I tried to discover which version of my npm or node was, that was the result:

                                                                                  $ npm - v
                                                                                  
                                                                                  output: 6.14.16
                                                                                  
                                                                                  $ node -v
                                                                                  
                                                                                  output: v14.19.1
                                                                                  

                                                                                  theoretically I can install nest, right? well, I ran this code:

                                                                                  $ npm i -g @nestjs/cli
                                                                                  
                                                                                  output: /home/user/.npm-global/bin/nest -> 
                                                                                  /home/user/.npm-global/lib/node_modules/@nestjs/cli/bin/nest.js
                                                                                  npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/@nestjs/cli/node_modules/chokidar/node_modules/fsevents):
                                                                                  npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
                                                                                  
                                                                                  + @nestjs/cli@8.2.3
                                                                                  updated 1 package in 17.045s
                                                                                  

                                                                                  I figured that this output seemed weird, even so I tried to discover if nest was installed

                                                                                  $ nest -v
                                                                                  
                                                                                  output: Command 'nest' not found, did you mean:
                                                                                  
                                                                                    command 'newt' from snap newt (0.0.1)
                                                                                    command 'net' from deb samba-common-bin (2:4.13.17~dfsg-0ubuntu0.21.04.1)
                                                                                    command 'next' from deb mailutils-mh (1:3.7-2.1)
                                                                                    command 'next' from deb mmh (0.4-2)
                                                                                    command 'next' from deb nmh (1.7.1-6)
                                                                                    command 'test' from deb coreutils (8.30-3ubuntu2)
                                                                                    command 'nast' from deb nast (0.2.0-7build1)
                                                                                    command 'neat' from deb neat (2.2-1build1)
                                                                                    command 'nes' from deb fceux (2.2.2+dfsg0-1build1)
                                                                                    command 'nes' from deb mednafen (1.22.2+dfsg-1build1)
                                                                                    command 'nes' from deb nestopia (1.50-1build1)
                                                                                  
                                                                                  See 'snap info ' for additional versions.
                                                                                  

                                                                                  I'm really new in this development 'and this is my first post here!' world but I appreciate your attention in my problem (also I'm not from USA so my English might be with lots of mistakes, sorry!)

                                                                                  ANSWER

                                                                                  Answered 2022-Mar-18 at 21:07

                                                                                  There are two way to solve your issue:

                                                                                  1. Use npx before every nestjs command:
                                                                                    npx @nestjs/cli g controller pages
                                                                                  
                                                                                  1. Add an alias inside your .bashrc or .zshrc (depend which one you are using):

                                                                                    To find your node path, type in your terminal:

                                                                                    which node
                                                                                  

                                                                                  or

                                                                                    which nodejs
                                                                                  

                                                                                  Then, when you have your path to node:

                                                                                    alias nest="/your/path/to/node/bin/nest"
                                                                                  

                                                                                  Then in your terminal you can test

                                                                                    nest --version
                                                                                  

                                                                                  It should work

                                                                                  Source https://stackoverflow.com/questions/71533051

                                                                                  QUESTION

                                                                                  Extract first element from all list of tuples in a row-wise manner in pandas dataframe
                                                                                  Asked 2022-Apr-03 at 17:16

                                                                                  I have a list of dataframes and the ninth column in all the dataframes is a list of tuples. I am trying to extract the first element from this list of tuples. If the number of element/elements obtained after removing the second element in the list of all the tuples is less than five I want to remove that row.

                                                                                  But for the moment I am not able to get only the first element of all the tuples in the list, I have looked the various responses given on the stackoverflow but no solution worked for me.

                                                                                  I have shown parts of the data below and also the code I have tried has been shown below,

                                                                                  >>> type(motifs[0])
                                                                                  
                                                                                  >>> len(motifs)
                                                                                  100
                                                                                  
                                                                                  >>> motifs[0]
                                                                                                                                     Enrichment  ...                                                   
                                                                                                                                            AUC  ...                                        TargetGenes
                                                                                  TF     MotifID                                                 ...                                                   
                                                                                  Arid3a tfdimers__MD00454                             0.074115  ...  [(Hmgb1, 1.1106060045583808), (Slc44a2, 0.4323...
                                                                                  Atf1   dbcorrdb__JUND__ENCSR000EGN_1__m1             0.079926  ...  [(Coq8b, 0.4451942964830318), (Tagln2, 0.56984...
                                                                                  Atf3   taipale_cyt_meth__JDP2_NRTGAYGTCAYN_FL_meth   0.058592  ...  [(Map1lc3a, 3.488720958149637), (Ccl4, 0.55845...
                                                                                         taipale_cyt_meth__XBP1_NRTGACGTCAYN_FL        0.059979  ...  [(Map1lc3a, 3.488720958149637), (Dusp1, 0.5584...
                                                                                         dbcorrdb__JUND__ENCSR000EGN_1__m1             0.059945  ...  [(Kdm6b, 3.488720958149637), (Junb, 0.55845389...
                                                                                  ...                                                       ...  ...                                                ...
                                                                                  Zmiz1  dbcorrdb__POLR2A__ENCSR000BMR_1__m1           0.084186  ...  [(Egr1, 0.2689079225312428), (Sumo1, 0.2982820...
                                                                                         dbcorrdb__HCFC1__ENCSR000ECH_1__m3            0.088241  ...  [(Egr1, 0.2689079225312428), (Sumo1, 0.2982820...
                                                                                         dbcorrdb__GABPA__ENCSR000BIW_1__m1            0.082741  ...  [(Egr1, 0.2689079225312428), (Vps52, 0.2982820...
                                                                                         dbcorrdb__GABPA__ENCSR000BLO_1__m1            0.081011  ...  [(Vps52, 0.2689079225312428), (Egr1, 0.2982820...
                                                                                         dbcorrdb__POLR2A__ENCSR000EAY_1__m1           0.083258  ...  [(Sumo1, 0.2689079225312428), (Leprotl1, 0.298...
                                                                                  
                                                                                  [15263 rows x 8 columns]
                                                                                  >>> motifs[1]
                                                                                                                               Enrichment  ...                                                   
                                                                                                                                      AUC  ...                                        TargetGenes
                                                                                  TF       MotifID                                         ...                                                   
                                                                                  AU041133 transfac_pro__M06033                  0.061555  ...  [(Topors, 0.9542964293512636), (Tm9sf3, 0.8081...
                                                                                  Arid3a   tfdimers__MD00454                     0.055638  ...  [(Hmgb1, 1.0336516736519146), (Zfp771, 1.24306...
                                                                                  Atf1     tfdimers__MD00439                     0.078748  ...  [(Mef2c, 0.4349350423233438), (Hcfc1, 1.0), (M...
                                                                                  Atf3     dbcorrdb__JUN__ENCSR000EGH_1__m1      0.065025  ...  [(Smox, 0.7721842224335954), (Junb, 3.41419581...
                                                                                           dbcorrdb__JUND__ENCSR000EGN_1__m1     0.074146  ...  [(Kdm6b, 0.7721842224335954), (Smox, 3.4141958...
                                                                                  ...                                                 ...  ...                                                ...
                                                                                  Zmiz1    dbcorrdb__POLR2A__ENCSR000BMR_1__m1   0.085257  ...  [(Egr1, 0.000962868898130634), (Sumo1, 0.39039...
                                                                                           dbcorrdb__HCFC1__ENCSR000ECH_1__m3    0.093355  ...  [(Lypla2, 0.000962868898130634), (Egr1, 0.3903...
                                                                                           dbcorrdb__GABPA__ENCSR000BIW_1__m1    0.089414  ...  [(Egr1, 0.000962868898130634), (Vps52, 0.39039...
                                                                                           dbcorrdb__GABPA__ENCSR000BLO_1__m1    0.085608  ...  [(Lypla2, 0.000962868898130634), (Mon1b, 0.390...
                                                                                           dbcorrdb__POLR2A__ENCSR000EAY_1__m1   0.078761  ...  [(Sumo1, 0.000962868898130634), (Lypla2, 0.390...
                                                                                  
                                                                                  [15442 rows x 8 columns]
                                                                                  # removing multi_index for the list of dataframes
                                                                                  >>> [df.reset_index(inplace=True) for df in motifs]
                                                                                  [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]
                                                                                  # The head of the columns containing list of tuples
                                                                                  >>> motifs[1][('Enrichment',           'TargetGenes')].head()
                                                                                  0    [(Topors, 0.9542964293512636), (Tm9sf3, 0.8081...
                                                                                  1    [(Hmgb1, 1.0336516736519146), (Zfp771, 1.24306...
                                                                                  2    [(Mef2c, 0.4349350423233438), (Hcfc1, 1.0), (M...
                                                                                  3    [(Smox, 0.7721842224335954), (Junb, 3.41419581...
                                                                                  4    [(Kdm6b, 0.7721842224335954), (Smox, 3.4141958...
                                                                                  Name: (Enrichment, TargetGenes), dtype: object
                                                                                  # If I try to geth the first element from the list of tuples, using the code below then it again gives the first tuple as given below,
                                                                                  >>> motifs[1][('Enrichment',           'TargetGenes')] = [ seq[0] for seq in motifs[1][('Enrichment',           'TargetGenes')] ]
                                                                                  >>> motifs[1][('Enrichment',           'TargetGenes')].head()
                                                                                  0    (Topors, 0.9542964293512636)
                                                                                  1     (Hmgb1, 1.0336516736519146)
                                                                                  2     (Mef2c, 0.4349350423233438)
                                                                                  3      (Smox, 0.7721842224335954)
                                                                                  4     (Kdm6b, 0.7721842224335954)
                                                                                  Name: (Enrichment, TargetGenes), dtype: object
                                                                                  
                                                                                  
                                                                                  # If I try another method using the same column for fifth dataframe then I get the following result as given below,
                                                                                  
                                                                                      >>> motifs[5][('Enrichment',           'TargetGenes')] = [(tup[0],) for tup in motifs[5][('Enrichment',           'TargetGenes')] ]
                                                                                  >>> motifs[5][('Enrichment',           'TargetGenes')].head()
                                                                                  0    ((Tagln2, 2.9989559716809815),)
                                                                                  1     ((Kdm6b, 2.9989559716809815),)
                                                                                  2     ((Kdm6b, 2.9989559716809815),)
                                                                                  3      ((Junb, 2.9989559716809815),)
                                                                                  4     ((Kdm6b, 2.9989559716809815),)
                                                                                  Name: (Enrichment, TargetGenes), dtype: object
                                                                                  >>> 
                                                                                  

                                                                                  The desired output is given below,

                                                                                  >>> motifs[5][('Enrichment',           'TargetGenes')].head()
                                                                                  0    ['Slc39a9', 'Arpc2', 'Arpc2', 'Arpc2', 'Phrf1']
                                                                                  1    ['Slc39a9', 'Arpc2', 'Arpc2', 'Slc39a9', 'Arpc2', 'Arpc2', 'Arpc2', 'Phrf1', 'Pafah1b1', 'Arpc2']
                                                                                  2    ['Supt16', 'Polr2m', 'Zfp668', 'Abl1', 'Thap1', 'Tia1', 'Cenpl'] 
                                                                                  

                                                                                  Therefore Is it possible to extract the list of first element from the list of tuples from column named TargetGenes in all the dataframes, like the one I have showed in the desired output ?

                                                                                  Update 1

                                                                                  I have provided the output of df.head(5).to_dict() below for few dataframes,

                                                                                  >>> motifs[9].head(5).to_dict()
                                                                                  {('TF', ''): {0: 'Arid3a', 1: 'Arnt', 2: 'Arnt', 3: 'Arnt', 4: 'Arnt'}, ('MotifID', ''): {0: 'tfdimers__MD00454', 1: 'taipale_cyt_meth__SREBF1_NTCACGTGAN_eDBD', 2: 'cisbp__M4597', 3: 'hocomoco__ATF3_HUMAN.H11MO.0.A', 4: 'cisbp__M4552'}, ('Enrichment', 'AUC'): {0: 0.06471430725162068, 1: 0.06095155535454042, 2: 0.07011658877330519, 3: 0.06705738981858385, 4: 0.06247801397055128}, ('Enrichment', 'Annotation'): {0: 'motif is annotated for orthologous gene ENSG00000116017 in H. sapiens (identity = 80%)', 1: "motif similar to transfac_public__M00539 ('V$ARNT_02: Arnt'; q-value = 3.13e-05) which is directly annotated", 2: "gene is annotated for similar motif transfac_public__M00539 ('V$ARNT_02: Arnt'; q-value = 0.000799)", 3: "gene is annotated for similar motif transfac_public__M00539 ('V$ARNT_02: Arnt'; q-value = 0.000575)", 4: "gene is annotated for similar motif transfac_public__M00539 ('V$ARNT_02: Arnt'; q-value = 0.000358)"}, ('Enrichment', 'Context'): {0: frozenset({'weight>75.0%', 'activating', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 1: frozenset({'weight>75.0%', 'activating', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 2: frozenset({'weight>75.0%', 'activating', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 3: frozenset({'weight>75.0%', 'activating', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 4: frozenset({'weight>75.0%', 'activating', 'mm10__refseq-r80__10kb_up_and_down_tss'})}, ('Enrichment', 'MotifSimilarityQvalue'): {0: 0.0, 1: 3.1e-05, 2: 0.000799, 3: 0.000575, 4: 0.00035800000000000003}, ('Enrichment', 'NES'): {0: 3.326402558504723, 1: 3.1209030910033024, 2: 3.922071066278296, 3: 3.654648993653949, 4: 3.2543395666659647}, ('Enrichment', 'OrthologousIdentity'): {0: 0.8094439999999999, 1: 1.0, 2: 1.0, 3: 1.0, 4: 1.0}, ('Enrichment', 'RankAtMax'): {0: 1185, 1: 298, 2: 901, 3: 865, 4: 4637}, ('Enrichment', 'TargetGenes'): {0: [('Hmgb1', 0.745314226221018), ('Zfp771', 0.6764829824966149), ('Irgc1', 1.9951670755270587), ('Bcl11a', 0.4856052689262107), ('Sh3kbp1', 0.5933072140052049), ('Traf3', 2.7600863350248512), ('Mars', 0.4505749371997108), ('Slc6a6', 1.0), ('Mlec', 0.39775865366894697), ('Rps6kb1', 0.40770958455266104), ('Slc12a4', 0.8671975714781245), ('Clic4', 0.7094675790094807), ('Lat2', 0.40522588119023456), ('Mcl1', 0.4268571683991914), ('Ptprj', 0.9892910773852126), ('Med27', 0.3965364187198045), ('Eif3a', 0.5472475711288725)], 1: [('Clcn6', 0.5838135470801639), ('Ptprs', 2.580731143355787), ('Erp29', 0.4427625162377926), ('Lin52', 0.4446103752969262), ('Smndc1', 0.5501206802490346), ('Scarb1', 1.038675980787723), ('Rnf146', 0.8398798839169821)], 2: [('Ptprs', 0.5838135470801639), ('Clcn6', 2.580731143355787), ('Pde7a', 0.4427625162377926), ('Smndc1', 0.4446103752969262), ('Ppp2r2a', 0.5501206802490346), ('Gzf1', 1.038675980787723), ('Paf1', 0.8398798839169821), ('Erp29', 0.9122832235342808), ('Ywhah', 1.0), ('Lin52', 0.6065115546339283), ('Atg10', 0.7179666115646837), ('Rnf146', 0.4719188766630129), ('Hlx', 0.4350102779899021), ('Mafk', 0.7611670711498808), ('Atg5', 1.5656437019255856)], 3: [('Ptprs', 0.5838135470801639), ('Clcn6', 2.580731143355787), ('Pde7a', 0.4427625162377926), ('Smndc1', 0.4446103752969262), ('Gzf1', 0.5501206802490346), ('Atg10', 1.038675980787723), ('Erp29', 0.8398798839169821), ('Paf1', 0.9122832235342808), ('Mff', 1.0), ('Ppp2r2a', 0.6065115546339283), ('Atg5', 0.7179666115646837), ('Rab1a', 0.4719188766630129), ('Rnf146', 0.4350102779899021), ('Mafk', 0.7611670711498808), ('Lin52', 1.5656437019255856), ('Hlx', 0.5914337023692341)], 4: [('Clcn6', 0.5838135470801639), ('Ptprs', 2.580731143355787), ('Lin52', 0.4427625162377926), ('Erp29', 0.4446103752969262), ('Smndc1', 0.5501206802490346), ('Rnf146', 1.038675980787723), ('Mff', 0.8398798839169821), ('Pde7a', 0.9122832235342808), ('Atg5', 1.0), ('Atg10', 0.6065115546339283), ('Hlx', 0.7179666115646837), ('Mlx', 0.4719188766630129), ('Ppp2r2a', 0.4350102779899021), ('Atp1a1', 0.7611670711498808), ('Mcmbp', 1.5656437019255856), ('Paf1', 0.5914337023692341), ('Mafk', 1.8757251159707784), ('Ywhah', 0.4148168160950648), ('Ykt6', 0.8740363421300391), ('Gzf1', 1.6749018097542459), ('Itpr1', 0.6244407603393514), ('Sec24c', 0.8125260569274086), ('Atp1b1', 1.3433579468658023), ('Cracr2a', 1.9825295293378795), ('Rabl6', 1.6060242452401532), ('Glo1', 4.075255658782804), ('Kat7', 2.1993521341931785), ('Mxd4', 1.546869996844828), ('Rab1a', 4.052034183647333), ('Taok3', 1.4156879591756044), ('Lonp2', 3.866232617909616), ('Bmp2k', 0.5805201605958586), ('Kcnn4', 0.7230752540573253), ('Nrip1', 0.4565406766743578), ('Hexb', 0.8850971245380614), ('Slc31a1', 5.410182658990805), ('Oat', 2.4192511357615585)]}}
                                                                                  >>> motifs[10].head(5).to_dict()
                                                                                  {('TF', ''): {0: 'Atf3', 1: 'Atf3', 2: 'Atf3', 3: 'Atf3', 4: 'Atf3'}, ('MotifID', ''): {0: 'dbcorrdb__JUN__ENCSR000EGH_1__m1', 1: 'dbcorrdb__JUND__ENCSR000EGN_1__m1', 2: 'cisbp__M5050', 3: 'dbcorrdb__eGFP-JUNB__ENCSR000DJY_1__m1', 4: 'dbcorrdb__FOSL1__ENCSR000BMV_1__m1'}, ('Enrichment', 'AUC'): {0: 0.06847185815248727, 1: 0.07298037887028418, 2: 0.05903279302412667, 3: 0.07423158995940253, 4: 0.07630307245136325}, ('Enrichment', 'Annotation'): {0: "gene is annotated for similar motif hocomoco__ATF3_MOUSE.H11MO.0.A ('ATF3_MOUSE'; q-value = 0.000773)", 1: "gene is orthologous to ENSG00000162772 in H. sapiens (identity = 95%) which is annotated for similar motif homer__DATGASTCATHN_Atf3 ('Atf3(bZIP)/GBM-ATF3-ChIP-Seq(GSE33912)/Homer'; q-value = 4.47e-05)", 2: "gene is annotated for similar motif hocomoco__ATF3_MOUSE.H11MO.0.A ('ATF3_MOUSE'; q-value = 0.000608)", 3: "gene is annotated for similar motif hocomoco__ATF3_MOUSE.H11MO.0.A ('ATF3_MOUSE'; q-value = 6.26e-06)", 4: "gene is annotated for similar motif hocomoco__ATF3_MOUSE.H11MO.0.A ('ATF3_MOUSE'; q-value = 3.66e-06)"}, ('Enrichment', 'Context'): {0: frozenset({'activating', 'weight>75.0%', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 1: frozenset({'activating', 'weight>75.0%', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 2: frozenset({'activating', 'weight>75.0%', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 3: frozenset({'activating', 'weight>75.0%', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 4: frozenset({'activating', 'weight>75.0%', 'mm10__refseq-r80__10kb_up_and_down_tss'})}, ('Enrichment', 'MotifSimilarityQvalue'): {0: 0.000773, 1: 4.5e-05, 2: 0.000608, 3: 6e-06, 4: 4e-06}, ('Enrichment', 'NES'): {0: 4.024298594227186, 1: 4.467018476489827, 2: 3.0974176805382267, 3: 4.589882728587765, 4: 4.793294566384112}, ('Enrichment', 'OrthologousIdentity'): {0: 1.0, 1: 0.950276, 2: 1.0, 3: 1.0, 4: 1.0}, ('Enrichment', 'RankAtMax'): {0: 481, 1: 1112, 2: 829, 3: 634, 4: 762}, ('Enrichment', 'TargetGenes'): {0: [('Tagln2', 1.6868254779790988), ('Junb', 2.131165507779861), ('Pim1', 0.5626962771519949), ('Mir155hg', 4.215511908233003), ('Kdm6b', 1.3831692473783712), ('Vcpip1', 0.4655884981482655), ('Ptp4a2', 0.4608012609224432), ('Lgals3', 1.2986893071734795), ('Dusp1', 5.525777129178691), ('Akt3', 2.302534028919806), ('Isg20', 1.565796075237834), ('Sec11c', 2.5799875669226298), ('Gpx1', 0.7797457421907137), ('Pmepa1', 1.0), ('Diaph2', 0.4567503652363437), ('Gadd45b', 0.4041840201626749), ('Traf1', 2.0641638640138207), ('Tnfaip8', 0.4166028876535105), ('Fam110a', 0.5565365664603831), ('Smim3', 4.4918400769026645)], 1: [('Kdm6b', 1.6868254779790988), ('Junb', 2.131165507779861), ('Tagln2', 0.5626962771519949), ('Dusp1', 4.215511908233003), ('Mir155hg', 1.3831692473783712), ('Sec11c', 0.4655884981482655), ('Ccnd2', 0.4608012609224432), ('Lgals3', 1.2986893071734795), ('Bach1', 5.525777129178691), ('Vcpip1', 2.302534028919806), ('Pim1', 1.565796075237834), ('Cdkn1a', 2.5799875669226298), ('Gadd45b', 0.7797457421907137), ('Akt3', 1.0), ('Diaph2', 0.4567503652363437), ('Zfp710', 0.4041840201626749), ('Ncoa3', 2.0641638640138207), ('Ptp4a2', 0.4166028876535105), ('Atf3', 0.5565365664603831), ('Traf1', 4.4918400769026645), ('Pkib', 0.6208941839583779), ('Isg20', 7.928134177072506), ('Abr', 21.31142622147593), ('Tnfaip8', 6.271477001021822), ('Ccr9', 1.7224099621172309), ('Klf6', 2.934167135195324), ('Cdc42ep4', 0.5109519744748661), ('Ncf2', 18.859900155945674), ('Psap', 0.7982368206818751), ('Txndc5', 24.13078778816305), ('Rps6ka1', 9.17079179660625), ('Sipa1l1', 2.302124705475682), ('Smim3', 6.291659684538216), ('Tgif1', 3.5504062994628045)], 2: [('Junb', 1.6868254779790988), ('Oser1', 2.131165507779861), ('Tagln2', 0.5626962771519949), ('Lgals3', 4.215511908233003), ('Bach1', 1.3831692473783712), ('Csrnp1', 0.4655884981482655), ('Kdm6b', 0.4608012609224432), ('Vcpip1', 1.2986893071734795), ('Gpx1', 5.525777129178691), ('Akt3', 2.302534028919806), ('Pim1', 1.565796075237834), ('Cdkn1a', 2.5799875669226298), ('Prnp', 0.7797457421907137), ('Klf6', 1.0), ('Ptp4a2', 0.4567503652363437), ('Rab8b', 0.4041840201626749), ('Pfn1', 2.0641638640138207), ('Mir155hg', 0.4166028876535105), ('Pmepa1', 0.5565365664603831), ('Dusp1', 4.4918400769026645), ('Abr', 0.6208941839583779), ('Fyb', 7.928134177072506), ('Tgif1', 21.31142622147593), ('Isg20', 6.271477001021822)], 3: [('Kdm6b', 1.6868254779790988), ('Junb', 2.131165507779861), ('Ptp4a2', 0.5626962771519949), ('Sec11c', 4.215511908233003), ('Lgals3', 1.3831692473783712), ('Pim1', 0.4655884981482655), ('Tagln2', 0.4608012609224432), ('Diaph2', 1.2986893071734795), ('Vcpip1', 5.525777129178691), ('Akt3', 2.302534028919806), ('Cdkn1a', 1.565796075237834), ('Mir155hg', 2.5799875669226298), ('Isg20', 0.7797457421907137), ('Gpx1', 1.0), ('Bach1', 0.4567503652363437), ('Txndc5', 0.4041840201626749), ('Ncf2', 2.0641638640138207), ('Dusp1', 0.4166028876535105), ('Pmepa1', 0.5565365664603831), ('Oser1', 4.4918400769026645), ('Fam110a', 0.6208941839583779), ('Rps6ka1', 7.928134177072506), ('Klf6', 21.31142622147593), ('Zfp710', 6.271477001021822), ('Bhlhe40', 1.7224099621172309), ('Tgif1', 2.934167135195324)], 4: [('Junb', 1.6868254779790988), ('Ptp4a2', 2.131165507779861), ('Pim1', 0.5626962771519949), ('Kdm6b', 4.215511908233003), ('Sec11c', 1.3831692473783712), ('Vcpip1', 0.4655884981482655), ('Diaph2', 0.4608012609224432), ('Mir155hg', 1.2986893071734795), ('Lgals3', 5.525777129178691), ('Bach1', 2.302534028919806), ('Akt3', 1.565796075237834), ('Tagln2', 2.5799875669226298), ('Isg20', 0.7797457421907137), ('Cdkn1a', 1.0), ('Bhlhe40', 0.4567503652363437), ('Gadd45b', 0.4041840201626749), ('Pmepa1', 2.0641638640138207), ('Gpx1', 0.4166028876535105), ('Txndc5', 0.5565365664603831), ('Ncf2', 4.4918400769026645), ('Csrnp1', 0.6208941839583779), ('Sipa1l1', 7.928134177072506), ('Klf6', 21.31142622147593), ('Zfp710', 6.271477001021822), ('Fam110a', 1.7224099621172309), ('Atf3', 2.934167135195324), ('Smim3', 0.5109519744748661), ('Ncoa3', 18.859900155945674)]}}
                                                                                  >>> motifs[11].head(5).to_dict()
                                                                                  {('TF', ''): {0: 'Arid3a', 1: 'Arid3a', 2: 'Arid3a', 3: 'Arnt', 4: 'Arnt'}, ('MotifID', ''): {0: 'cisbp__M1879', 1: 'swissregulon__hs__FOXA2.p3', 2: 'homer__AAAGTAAACA_FOXA1_GSE26831', 3: 'cisbp__M5633', 4: 'cisbp__M5866'}, ('Enrichment', 'AUC'): {0: 0.0668223211428239, 1: 0.06646591603386576, 2: 0.06737511274039161, 3: 0.06968363311646894, 4: 0.06836969001148106}, ('Enrichment', 'Annotation'): {0: "gene is orthologous to ENSG00000116017 in H. sapiens (identity = 79%) which is annotated for similar motif dbcorrdb__ARID3A__ENCSR000EDP_1__m1 ('ARID3A (ENCSR000EDP-1, motif 1)'; q-value = 0.00023)", 1: "gene is orthologous to ENSG00000116017 in H. sapiens (identity = 79%) which is annotated for similar motif dbcorrdb__ARID3A__ENCSR000EDP_1__m1 ('ARID3A (ENCSR000EDP-1, motif 1)'; q-value = 0.00023)", 2: "motif similar to dbcorrdb__ARID3A__ENCSR000EDP_1__m1 ('ARID3A (ENCSR000EDP-1, motif 1)'; q-value = 8.23e-06) which is annotated for orthologous gene ENSG00000116017 in H. sapiens (identity = 80%)", 3: "gene is annotated for similar motif transfac_public__M00539 ('V$ARNT_02: Arnt'; q-value = 0.000417)", 4: "gene is annotated for similar motif transfac_public__M00539 ('V$ARNT_02: Arnt'; q-value = 0.000133)"}, ('Enrichment', 'Context'): {0: frozenset({'activating', 'weight>75.0%', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 1: frozenset({'activating', 'weight>75.0%', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 2: frozenset({'activating', 'weight>75.0%', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 3: frozenset({'activating', 'weight>75.0%', 'mm10__refseq-r80__10kb_up_and_down_tss'}), 4: frozenset({'activating', 'weight>75.0%', 'mm10__refseq-r80__10kb_up_and_down_tss'})}, ('Enrichment', 'MotifSimilarityQvalue'): {0: 0.00023, 1: 0.00023, 2: 8e-06, 3: 0.000417, 4: 0.000133}, ('Enrichment', 'NES'): {0: 3.048011522275345, 1: 3.020345923942252, 2: 3.090921429894018, 3: 3.726068046226016, 4: 3.6125945303641087}, ('Enrichment', 'OrthologousIdentity'): {0: 0.798669, 1: 0.798669, 2: 0.8094439999999999, 3: 1.0, 4: 1.0}, ('Enrichment', 'RankAtMax'): {0: 414, 1: 352, 2: 398, 3: 945, 4: 499}, ('Enrichment', 'TargetGenes'): {0: [('Arid3a', 1.0814455429211889), ('Pogz', 0.6244276987659271), ('Ago4', 0.9664526956346918), ('Taf1b', 0.44722261016464504), ('Itpr1', 0.8313950646937135), ('Hmgb1', 1.9945139689034008), ('Sh3kbp1', 1.0), ('Cd180', 0.6042623259696077)], 1: [('Arid3a', 1.0814455429211889), ('Pogz', 0.6244276987659271), ('Ago4', 0.9664526956346918), ('Taf1b', 0.44722261016464504), ('Itpr1', 0.8313950646937135), ('Hmgb1', 1.9945139689034008), ('Sh3kbp1', 1.0), ('Cd180', 0.6042623259696077)], 2: [('Pogz', 1.0814455429211889), ('Itpr1', 0.6244276987659271), ('Arid3a', 0.9664526956346918), ('Sh3kbp1', 0.44722261016464504), ('Hmgb1', 0.8313950646937135), ('Clpx', 1.9945139689034008), ('Med27', 1.0), ('Fgfr1op2', 0.6042623259696077)], 3: [('Clcn6', 0.8095717882553205), ('Kansl1', 1.5834902996396047), ('Lin52', 1.7464790457683428), ('Ptprs', 1.18907063271503), ('Asna1', 0.4109458104482189), ('Ccdc91', 1.064875281051844), ('Erp29', 1.2944573975829907), ('Zfas1', 1.0), ('Rnf146', 0.5426386495200634), ('Smndc1', 1.3368937988306546), ('Pabpc1', 1.4072285212815487), ('Cracr2a', 2.3364193374078432), ('Mafk', 0.6752603264576597), ('Mcmbp', 0.3974384266129632)], 4: [('Clcn6', 0.8095717882553205), ('Lin52', 1.5834902996396047), ('Ptprs', 1.7464790457683428), ('Kansl1', 1.18907063271503), ('Asna1', 0.4109458104482189), ('Smndc1', 1.064875281051844), ('Rnf146', 1.2944573975829907), ('Dnajc13', 1.0), ('Ccdc91', 0.5426386495200634), ('Erp29', 1.3368937988306546)]}}
                                                                                  >>>
                                                                                  

                                                                                  Thanks,

                                                                                  ANSWER

                                                                                  Answered 2022-Apr-03 at 17:16

                                                                                  IIUC, you could use a comprehension:

                                                                                  for df in motifs:
                                                                                      df['first_elements'] = df.iloc[:, 9].apply(lambda li: [x[0] for x in li])
                                                                                  

                                                                                  Output:

                                                                                  [       TF                                   MotifID Enrichment  \
                                                                                                                                             AUC   
                                                                                  0  Arid3a                         tfdimers__MD00454   0.064714   
                                                                                  1    Arnt  taipale_cyt_meth__SREBF1_NTCACGTGAN_eDBD   0.060952   
                                                                                  2    Arnt                              cisbp__M4597   0.070117   
                                                                                  3    Arnt            hocomoco__ATF3_HUMAN.H11MO.0.A   0.067057   
                                                                                  4    Arnt                              cisbp__M4552   0.062478   
                                                                                  
                                                                                                                                        \
                                                                                                                            Annotation   
                                                                                  0  motif is annotated for orthologous gene ENSG00...   
                                                                                  1  motif similar to transfac_public__M00539 ('V$A...   
                                                                                  2  gene is annotated for similar motif transfac_p...   
                                                                                  3  gene is annotated for similar motif transfac_p...   
                                                                                  4  gene is annotated for similar motif transfac_p...   
                                                                                  
                                                                                                                                                              \
                                                                                                                               Context MotifSimilarityQvalue   
                                                                                  0  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000000   
                                                                                  1  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000031   
                                                                                  2  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000799   
                                                                                  3  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000575   
                                                                                  4  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000358   
                                                                                  
                                                                                                                             \
                                                                                          NES OrthologousIdentity RankAtMax   
                                                                                  0  3.326403            0.809444      1185   
                                                                                  1  3.120903            1.000000       298   
                                                                                  2  3.922071            1.000000       901   
                                                                                  3  3.654649            1.000000       865   
                                                                                  4  3.254340            1.000000      4637   
                                                                                  
                                                                                                                                        \
                                                                                                                           TargetGenes   
                                                                                  0  [(Hmgb1, 0.745314226221018), (Zfp771, 0.676482...   
                                                                                  1  [(Clcn6, 0.5838135470801639), (Ptprs, 2.580731...   
                                                                                  2  [(Ptprs, 0.5838135470801639), (Clcn6, 2.580731...   
                                                                                  3  [(Ptprs, 0.5838135470801639), (Clcn6, 2.580731...   
                                                                                  4  [(Clcn6, 0.5838135470801639), (Ptprs, 2.580731...   
                                                                                  
                                                                                                                        first_elements  
                                                                                                                                        
                                                                                  0  [Hmgb1, Zfp771, Irgc1, Bcl11a, Sh3kbp1, Traf3,...  
                                                                                  1  [Clcn6, Ptprs, Erp29, Lin52, Smndc1, Scarb1, R...  
                                                                                  2  [Ptprs, Clcn6, Pde7a, Smndc1, Ppp2r2a, Gzf1, P...  
                                                                                  3  [Ptprs, Clcn6, Pde7a, Smndc1, Gzf1, Atg10, Erp...  
                                                                                  4  [Clcn6, Ptprs, Lin52, Erp29, Smndc1, Rnf146, M...  ,      TF                                 MotifID Enrichment  \
                                                                                                                                         AUC   
                                                                                  0  Atf3        dbcorrdb__JUN__ENCSR000EGH_1__m1   0.068472   
                                                                                  1  Atf3       dbcorrdb__JUND__ENCSR000EGN_1__m1   0.072980   
                                                                                  2  Atf3                            cisbp__M5050   0.059033   
                                                                                  3  Atf3  dbcorrdb__eGFP-JUNB__ENCSR000DJY_1__m1   0.074232   
                                                                                  4  Atf3      dbcorrdb__FOSL1__ENCSR000BMV_1__m1   0.076303   
                                                                                  
                                                                                                                                        \
                                                                                                                            Annotation   
                                                                                  0  gene is annotated for similar motif hocomoco__...   
                                                                                  1  gene is orthologous to ENSG00000162772 in H. s...   
                                                                                  2  gene is annotated for similar motif hocomoco__...   
                                                                                  3  gene is annotated for similar motif hocomoco__...   
                                                                                  4  gene is annotated for similar motif hocomoco__...   
                                                                                  
                                                                                                                                                              \
                                                                                                                               Context MotifSimilarityQvalue   
                                                                                  0  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000773   
                                                                                  1  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000045   
                                                                                  2  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000608   
                                                                                  3  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000006   
                                                                                  4  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000004   
                                                                                  
                                                                                                                             \
                                                                                          NES OrthologousIdentity RankAtMax   
                                                                                  0  4.024299            1.000000       481   
                                                                                  1  4.467018            0.950276      1112   
                                                                                  2  3.097418            1.000000       829   
                                                                                  3  4.589883            1.000000       634   
                                                                                  4  4.793295            1.000000       762   
                                                                                  
                                                                                                                                        \
                                                                                                                           TargetGenes   
                                                                                  0  [(Tagln2, 1.6868254779790988), (Junb, 2.131165...   
                                                                                  1  [(Kdm6b, 1.6868254779790988), (Junb, 2.1311655...   
                                                                                  2  [(Junb, 1.6868254779790988), (Oser1, 2.1311655...   
                                                                                  3  [(Kdm6b, 1.6868254779790988), (Junb, 2.1311655...   
                                                                                  4  [(Junb, 1.6868254779790988), (Ptp4a2, 2.131165...   
                                                                                  
                                                                                                                        first_elements  
                                                                                                                                        
                                                                                  0  [Tagln2, Junb, Pim1, Mir155hg, Kdm6b, Vcpip1, ...  
                                                                                  1  [Kdm6b, Junb, Tagln2, Dusp1, Mir155hg, Sec11c,...  
                                                                                  2  [Junb, Oser1, Tagln2, Lgals3, Bach1, Csrnp1, K...  
                                                                                  3  [Kdm6b, Junb, Ptp4a2, Sec11c, Lgals3, Pim1, Ta...  
                                                                                  4  [Junb, Ptp4a2, Pim1, Kdm6b, Sec11c, Vcpip1, Di...  ,        TF                           MotifID Enrichment  \
                                                                                                                                     AUC   
                                                                                  0  Arid3a                      cisbp__M1879   0.066822   
                                                                                  1  Arid3a        swissregulon__hs__FOXA2.p3   0.066466   
                                                                                  2  Arid3a  homer__AAAGTAAACA_FOXA1_GSE26831   0.067375   
                                                                                  3    Arnt                      cisbp__M5633   0.069684   
                                                                                  4    Arnt                      cisbp__M5866   0.068370   
                                                                                  
                                                                                                                                        \
                                                                                                                            Annotation   
                                                                                  0  gene is orthologous to ENSG00000116017 in H. s...   
                                                                                  1  gene is orthologous to ENSG00000116017 in H. s...   
                                                                                  2  motif similar to dbcorrdb__ARID3A__ENCSR000EDP...   
                                                                                  3  gene is annotated for similar motif transfac_p...   
                                                                                  4  gene is annotated for similar motif transfac_p...   
                                                                                  
                                                                                                                                                              \
                                                                                                                               Context MotifSimilarityQvalue   
                                                                                  0  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000230   
                                                                                  1  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000230   
                                                                                  2  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000008   
                                                                                  3  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000417   
                                                                                  4  (activating, mm10__refseq-r80__10kb_up_and_dow...              0.000133   
                                                                                  
                                                                                                                             \
                                                                                          NES OrthologousIdentity RankAtMax   
                                                                                  0  3.048012            0.798669       414   
                                                                                  1  3.020346            0.798669       352   
                                                                                  2  3.090921            0.809444       398   
                                                                                  3  3.726068            1.000000       945   
                                                                                  4  3.612595            1.000000       499   
                                                                                  
                                                                                                                                        \
                                                                                                                           TargetGenes   
                                                                                  0  [(Arid3a, 1.0814455429211889), (Pogz, 0.624427...   
                                                                                  1  [(Arid3a, 1.0814455429211889), (Pogz, 0.624427...   
                                                                                  2  [(Pogz, 1.0814455429211889), (Itpr1, 0.6244276...   
                                                                                  3  [(Clcn6, 0.8095717882553205), (Kansl1, 1.58349...   
                                                                                  4  [(Clcn6, 0.8095717882553205), (Lin52, 1.583490...   
                                                                                  
                                                                                                                        first_elements  
                                                                                                                                        
                                                                                  0  [Arid3a, Pogz, Ago4, Taf1b, Itpr1, Hmgb1, Sh3k...  
                                                                                  1  [Arid3a, Pogz, Ago4, Taf1b, Itpr1, Hmgb1, Sh3k...  
                                                                                  2  [Pogz, Itpr1, Arid3a, Sh3kbp1, Hmgb1, Clpx, Me...  
                                                                                  3  [Clcn6, Kansl1, Lin52, Ptprs, Asna1, Ccdc91, E...  
                                                                                  4  [Clcn6, Lin52, Ptprs, Kansl1, Asna1, Smndc1, R...  ]
                                                                                  

                                                                                  Source https://stackoverflow.com/questions/71709787

                                                                                  QUESTION

                                                                                  Error ' not supported between instances of float and str ' when I try to use .sort() on a Python list
                                                                                  Asked 2022-Apr-01 at 04:45

                                                                                  The error is occurring when I try to sort this data list:

                                                                                      para_planilha = [['2022-04-01T17:00:00Z', '2022/04/01 00:58:25', '-', 'ATSV Erlangen', 'FC Eintracht Bamberg', '-', '-', '-', '-', '-'], ['2022-04-02T03:05:00Z', '2022/04/01 00:58:27', '-', 'Western United', 'Central Coast Mariners', 2.08, 3.75, 3.7, 2.06, 1.78], ['2022-04-01T18:45:00Z', '2022/04/01 00:58:28', '-', 'Kfco Beerschot Wilrijk', 'Club Brugge', 11.0, 1.33, 6.4, 2.5, 1.58], ['2022-04-01T18:30:00Z', '2022/04/01 00:58:29', '-', 'CA Fenix', 'Deportivo Merlo', 3.4, 2.32, 3.85, '-', '-'], ['2022-04-01T23:30:00Z', '2022/04/01 00:58:30', '-', 'CA Ituzaingo', 'CA Colegiales', '-', '-', '-', '-', 3.4], ['2022-04-01T18:45:00Z', '2022/04/01 00:58:31', '-', 'Edinburgh City', 'Kelty Hearts', 4.6, 1.72, 5.5, 2.02, '-'], ['2022-04-01T11:00:00Z', '2022/04/01 00:58:32', '-', 'Navy FC', 'Khonkaen', 4.3, 2.02, 3.7, 1.85, 1.82], ['2022-04-01T16:00:00Z', '2022/04/01 00:58:33', '-', 'Samger FC', 'Banjul United', '-', '-', '-', '-', '-'], ['2022-04-01T18:45:00Z', '2022/04/01 00:58:34', '-', 'Connahs Quay', 'Aberystwyth', '-', '-', '-', '-', '-'], ['2022-04-01T18:45:00Z', '2022/04/01 00:58:35', '-', 'Caernarfon Town', 'The New Saints', '-', '-', '-', '-', '-'], ['2022-04-01T17:00:00Z', '2022/04/01 00:58:36', '-', 'Tuzlaspor', 'Umraniyespor', 4.3, 1.96, 3.85, 1.78, 2.26], ['2022-04-01T17:30:00Z', '2022/04/01 00:58:37', '-', 'Yverdon Sport', 'FC Vaduz', 2.22, 3.45, 3.8, 2.06, 1.95], ['2022-04-01T17:30:00Z', '2022/04/01 00:58:38', '-', 'Rot-Weiss Essen', 'FC Koln II', '-', '-', '-', 4.3, 1.3], ['2022-04-01T15:45:00Z', '2022/04/01 00:58:38', '-', 'Herstedoester IC', 'Avarta', '-', '-', '-', '-', '-'], ['2022-04-01T17:00:00Z', '2022/04/01 00:58:39', '-', 'SV Tasmania Berlin', 'Berliner AK', '-', 1.57, 4.8, 2.1, 1.86], ['2022-04-01T16:00:00Z', '2022/04/01 00:58:40', '-', 'Tallinna Kalev', 'Paide Linnameeskond', 80.0, '-', '-', 3.35, 1.33], ['2022-04-01T12:00:00Z', '2022/04/01 00:58:41', '-', 'Millwall U23', 'Peterborough United U23', 2.18, 2.96, 3.5, 2.56, 1.48], ['2022-04-01T18:45:00Z', '2022/04/01 00:58:42', '-', 'Hull', 'Huddersfield', 2.88, 2.84, 3.35, 1.74, 2.34], ['2022-04-01T23:00:00Z', '2022/04/01 00:58:43', '-', 'Palmeiras (W)', 'CR Flamengo (W)', 1.56, 6.0, 4.1, '-', 1.88], ['2022-04-01T16:00:00Z', '2022/04/01 00:58:44', '-', 'SFC Opava', 'Vysocina Jihlava', 1.71, 4.6, '-', '-', 1.75], ['2022-04-02T00:10:00Z', '2022/04/01 00:58:45', '-', 'Belgrano', 'All Boys', '-', '-', 3.75, '-', '-'], ['2022-04-01T16:00:00Z', '2022/04/01 00:58:46', '-', 'FC Zbrojovka Brno', 'Pribram', 1.45, 10.5, 4.3, '-', 1.64], ['2022-04-01T14:30:00Z', '2022/04/01 00:58:47', '-', 'FK Nevezis', 'BFA Vilnius', '-', '-', '-', 4.5, '-'], ['2022-04-02T00:15:00Z', '2022/04/01 00:58:48', '-', 'Resistencia SC', 'Olimpia', '-', 1.84, '-', '-', 1.78], ['2022-04-01T14:00:00Z', '2022/04/01 00:58:49', '-', 'FCV Farul Constanta II', 'CS Gloria Albesti', '-', '-', '-', '-', '-'], ['2022-04-01T14:00:00Z', '2022/04/01 00:58:51', '-', 'CSM Deva', 'Vointa Lupac', '-', '-', '-', 2.14, '-'], ['2022-04-01T22:00:00Z', '2022/04/01 00:58:52', '-', 'Cerro Porteno', '12 de Octubre de Itaugua', 1.42, '-', '-', '-', 1.7], ['2022-04-01T14:00:00Z', '2022/04/01 00:58:53', '-', 'Csm Slatina', 'ACS Vedita Colonesti MS', '-', '-', '-', '-', '-'], ['2022-04-01T14:00:00Z', '2022/04/01 00:58:53', '-', 'CSM Flacara Moreni', 'ACS FC Academica Clinceni 2', '-', '-', '-', '-', '-'], [2.36, '-'], ['2022-04-01T14:00:00Z', '2022/04/01 00:58:55', '-', 'Dinamo Bucuresti II', 'CS Real Bradu', 1.93, '-', '-', '-', '-'], ['2022-04-01T14:00:00Z', '2022/04/01 00:58:56', '-', 'FCSB II', 'FC Arges II', '-', '-', '-', '-', '-'], ['2022-04-01T18:00:00Z', '2022/04/01 00:58:57', '-', 'Mezokovesd-Zsory', 'Gyirmot', 2.16, 4.6, 3.35, 1.78, 2.26], ['2022-04-01T14:00:00Z', '2022/04/01 00:58:58', '-', 'CFR Cluj SA II', 'CSM Satu Mare', '-', '-', '-', 2.12, '-'], ['2022-04-02T00:00:00Z', '2022/04/01 00:58:59', '-', 'Estudiantes Rio Cuarto', 'Atletico Rafaela', 2.34, '-', 3.0, '-', '-'], ['2022-04-02T00:30:00Z', '2022/04/01 00:59:00', '-', 'Gimnasia Jujuy', 'Chaco For Ever', '-', 2.96, 2.8, '-', '-'], ['2022-04-01T18:00:00Z', '2022/04/01 00:59:01', '-', 'Fulham U23', 'Birmingham U23', 1.41, '-', '-', 2.8, '-'], ['2022-04-01T19:00:00Z', '2022/04/01 00:59:02', '-', 'Girona', 'Malaga', 1.58, 7.4, 4.5, 1.76, '-'], ['2022-04-01T18:00:00Z', '2022/04/01 00:59:04', '-', 'Boca Juniors (W)', 'Gimnasia de La Plata (W)', '-', '-', '-', '-', '-'], ['2022-04-01T22:00:00Z', '2022/04/01 00:59:05', '-', 'Patronato', 'Union Santa Fe', 3.95, 2.28, 3.4, '-', '-'], ['2022-04-01T17:30:00Z', '2022/04/01 00:59:06', '-', 'Schaffhausen', 'Neuchatel Xamax', 1.86, 4.6, 3.75, 2.12, '-'], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:07', '-', 'Krka', 'Krsko', '-', '-', '-', '-', '-'], ['2022-04-01T18:15:00Z', '2022/04/01 00:59:08', '-', 'FC Wil', 'Aarau', 3.75, 1.96, 4.5, 2.74, 1.57], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:09', '-', 'BK Hacken (W)', 'Hammarby (W)', 1.41, 8.6, 5.6, 2.48, '-'], ['2022-04-01T15:00:00Z', '2022/04/01 00:59:10', '-', 'FK Spartaks', 'Liepajas Metalurgs', '-', '-', '-', '-', '-'], ['2022-04-01T16:30:00Z', '2022/04/01 00:59:11', '-', 'Triglav', 'Drava (Slovenia)', '-', 24.0, '-', 3.2, 1.49], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:12', '-', 'Assyriska BK', 'Varbergs GIF', 2.34, '-', '-', '-', '-'], ['2022-04-02T01:00:00Z', '2022/04/01 00:59:13', '-', 'San Francisco FC', 'Plaza Amador', '-', '-', 2.86, '-', '-'], ['2022-04-01T14:15:00Z', '2022/04/01 00:59:14', '-', 'Khaitan', 'Al Yarmouk', 2.16, '-', 3.65, '-', '-'], ['2022-04-01T10:45:00Z', '2022/04/01 00:59:15', '-', 'Maccabi Kabilio Jaffa', 'AS Nordia Jerusalem', '-', 15.0, 6.2, 1.89, 1.93], ['2022-04-01T15:00:00Z', '2022/04/01 00:59:16', '-', 'FC Viktoria Otrokovice', 'H Slavia Kromeriz', '-', '-', '-', '-', '-'], ['2022-04-01T10:45:00Z', '2022/04/01 00:59:17', '-', 'Hapoel Azor', 'Ironi Kuseife', 1.9, 3.55, 3.25, 1.78, '-'], ['2022-04-01T14:30:00Z', '2022/04/01 00:59:18', '-', 'FC U Craiova 1948', 'CS Mioveni', 2.06, 4.8, 3.2, 1.45, '-'], ['2022-04-01T09:00:00Z', '2022/04/01 00:59:19', '-', 'Hapoel Bikat Hayarden', 'Hapoel Bnei Lod', '-', 7.0, 5.1, 1.97, '-'], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:20', '-', 'Toolon Taisto', 'Sexy Poxyt', '-', '-', '-', '-', '-'], ['2022-04-01T17:30:00Z', '2022/04/01 00:59:21', '-', 'Chindia Targoviste', 'Dinamo Bucharest', 2.04, 5.3, 3.35, '-', 2.8], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:22', '-', 'PuiU Helsinki', 'HIFK 2', '-', '-', '-', '-', '-'], ['2022-04-01T18:15:00Z', '2022/04/01 00:59:22', '-', 'Sporting Cristal', 'Uni San Martin', '-', 9.8, 6.2, 2.5, 1.57], ['2022-04-01T18:00:00Z', '2022/04/01 00:59:23', '-', 'Siegburger SV\xa004', 'Borussia Freialdenhoven', '-', '-', '-', '-', '-'], ['2022-04-01T16:00:00Z', '2022/04/01 00:59:25', '-', 'Markez Tulkrem', 'Hilal Al Quds', 7.8, 1.55, 4.7, 2.5, 1.5], ['2022-04-01T16:30:00Z', '2022/04/01 00:59:25', '-', 'Kolubara Lazarevac', 'Mladost Lucani', '-', '-', '-', 1.89, 1.96], ['2022-04-01T16:30:00Z', '2022/04/01 00:59:27', '-', 'Fredericia', 'Hvidovre', 2.26, 3.3, 3.8, '-', 1.84], ['2022-04-01T16:00:00Z', '2022/04/01 00:59:27', '-', 'Thisted (W)', 'Fortuna Hjorring (W)', '-', '-', '-', '-', '-'], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:29', '-', 'Fremad Amager', 'Jammerbught FC', 1.57, 7.0, 4.5, 2.1, 1.9], ['2022-04-01T13:00:00Z', '2022/04/01 00:59:30', '-', 'Maccabi Ahi Nazareth', 'Beitar Tel Aviv Ramla', 2.56, 3.55, 3.1, '-', '-'], ['2022-04-02T00:40:00Z', '2022/04/01 00:59:31', '-', 'La Equidad', 'Deportivo Cali', '-', 3.8, 2.94, 1.54, '-'], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:31', '-', 'Viborg', 'SonderjyskE', 1.78, 5.5, 3.85, 1.99, 2.0], ['2022-04-01T18:30:00Z', '2022/04/01 00:59:32', '-', 'Podbeskidzie B-B', 'LKS Lodz', 2.32, 3.85, 3.3, '-', '-'], ['2022-04-01T18:45:00Z', '2022/04/01 00:59:34', '-', 'Sligo Rovers', 'Shelbourne', 1.82, 5.6, 3.7, '-', '-'], ['2022-04-01T17:30:00Z', '2022/04/01 00:59:34', '-', 'ASV Drassburg', 'SC Mannsdorf', '-', '-', '-', '-', '-'], ['2022-04-01T19:00:00Z', '2022/04/01 00:59:35', '-', 'Alafoss', 'UMF Tindstoll', '-', '-', '-', '-', '-'], ['2022-04-01T19:15:00Z', '2022/04/01 00:59:36', '-', 'IR Reykjavik', 'Throttur', '-', '-', '-', '-', '-'], ['2022-04-01T16:00:00Z', '2022/04/01 00:59:37', '-', 'Gambia Ports Authority', 'Banjul Hawks FC', '-', '-', '-', '-', '-'], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:38', '-', 'Red Star', 'Creteil', 1.63, '-', '-', '-', 2.2], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:39', '-', 'FC Bastia-Borgo', 'Stade Briochin', '-', 2.72, 3.05, 1.62, 1.45], ['2022-04-01T15:30:00Z', '2022/04/01 00:59:40', '-', 'Moghreb Tetouan', 'Raja Beni Mellal', '-', '-', '-', '-', '-'], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:41', '-', 'Orleans', 'Le Mans', 2.42, '-', 3.25, 1.78, 2.28], ['2022-04-01T19:15:00Z', '2022/04/01 00:59:42', '-', 'Braga', 'Benfica', 3.4, 2.24, 3.6, 2.06, 1.84], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:43', '-', 'Annecy', 'Avranches', 1.58, 7.4, 3.75, 1.71, 2.26], ['2022-04-01T18:00:00Z', '2022/04/01 00:59:44', '-', 'Lierse', 'Waasland-Beveren', 3.2, 2.28, 3.8, '-', 1.75], ['2022-04-01T15:30:00Z', '2022/04/01 00:59:45', '-', 'Stade Marocain du Rabat', 'Waf Widad Fes', '-', 5.6, 3.2, '-', '-'], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:45', '-', 'Boulogne', 'Sete', 2.46, 3.8, 2.94, 1.56, 2.56], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:46', '-', 'Chambly Oise', 'Chateauroux', 4.3, 2.2, 3.3, 1.63, 2.36], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:47', '-', 'Concarneau', 'Bourg-en-Bresse', '-', '-', 3.1, 1.55, '-'], ['2022-04-01T17:00:00Z', '2022/04/01 00:59:48', '-', 'Villefranche Beaujolais', 'Cholet SO', 1.63, 7.0, '-', 1.92, 2.02], ['2022-04-01T16:00:00Z', '2022/04/01 00:59:49', '-', 'Sandecja Nowy Sacz', 'Korona Kielce', '-', '-', 3.05, 1.68, '-'], ['2022-04-01T17:30:00Z', '2022/04/01 00:59:50', '-', 'Alkmaar (W)', 'Feyenoord (W)', '-', '-', '-', 2.9, 1.55], ['2022-04-01T17:30:00Z', '2022/04/01 00:59:51', '-', 'ADO Den Haag (W)', 'FC Zwolle (W)', 1.74, '-', '-', '-', '-'], ['2022-04-01T18:45:00Z', '2022/04/01 00:59:52', '-', 'Wexford F.C', 'Cork City', '-', 1.89, '-', '-', '-'], ['2022-04-01T17:30:00Z', '2022/04/01 00:59:53', '-', 'PSV Eindhoven (W)', 'Heerenveen (W)', 1.32, '-', '-', 3.5, '-'], ['2022-04-01T18:45:00Z', '2022/04/01 00:59:54', '-', 'Waterford', 'Longford', 1.59, 5.9, 4.4, '-', 1.9], ['2022-04-01T17:30:00Z', '2022/04/01 00:59:55', '-', 'Excelsior (W)', 'Twente (W)', '-', 1.13, '-', '-', 1.17], ['2022-04-02T00:00:00Z', '2022/04/01 00:59:56', '-', 'Univ Catolica (Ecu)', 'Barcelona (Ecu)', 2.54, 3.0, 3.3, '-', '-'], ['2022-04-02T02:00:00Z', '2022/04/01 00:59:57', '-', 'Emelec', 'LDU', '-', 3.65, '-', 2.34, '-'], ['2022-04-01T18:45:00Z', '2022/04/01 00:59:58', '-', 'St Patricks', 'Drogheda', 1.46, 9.0, 4.8, '-', '-'], ['2022-04-01T18:45:00Z', '2022/04/01 00:59:59', '-', 'Ayr', 'Hamilton', 2.78, 2.94, 3.25, '-', '-'], ['2022-04-01T12:15:00Z', '2022/04/01 01:00:00', '-', 'Shimshon Tel Aviv', 'Maccabi Ashdod B.C.', '-', '-', 3.2, 1.8, '-'], ['2022-04-01T14:00:00Z', '2022/04/01 01:00:01', '-', 'Shabab Al Khaleel', 'Shabab Al Dharia', 1.5, '-', '-', 1.99, '-'], ['2022-04-01T17:00:00Z', '2022/04/01 01:00:02', '-', 'SV Meppen', 'Wehen Wiesbaden', 3.9, 2.04, 3.9, 2.08, 1.94], ['2022-04-01T18:30:00Z', '2022/04/01 01:00:03', '-', 'Union Berlin', 'FC Koln', 2.44, 3.35, 3.5, 1.92, 2.04], ['2022-04-01T18:45:00Z', '2022/04/01 01:00:04', '-', 'Morton', 'Kilmarnock', 4.4, 2.0, 3.4, '-', '-'], ['2022-04-02T00:00:00Z', '2022/04/01 01:00:05', '-', 'Universidad Guadalajara', 'Tampico Madero', 1.9, 5.0, 3.45, 1.77, 2.14], ['2022-04-01T14:00:00Z', '2022/04/01 01:00:06', '-', 'CS Constantine', 'Paradou', 1.86, 4.4, '-', '-', 2.62], ['2022-04-01T17:30:00Z', '2022/04/01 01:00:07', '-', 'FCM TQS Traiskirchen', 'SC Wiener Neustadt', '-', '-', '-', '-', '-'], ['2022-04-01T17:00:00Z', '2022/04/01 01:00:08', '-', 'SC Kalsdorf', 'SC Weiz', 2.12, '-', '-', '-', '-'], ['2022-04-01T17:30:00Z', '2022/04/01 01:00:09', '-', 'Wiener SK', 'Ask-Bsc Bruck/Leitha', 1.64, '-', '-', '-', '-'], ['2022-04-01T10:30:00Z', '2022/04/01 01:00:10', '-', 'Hapoel Marmorek', 'Bnei Eilat', 1.57, 5.6, '-', 2.06, 1.85], ['2022-04-01T18:45:00Z', '2022/04/01 01:00:11', '-', 'Dundalk', 'UCD', 1.43, 9.0, '-', 2.02, 1.76], ['2022-04-01T19:00:00Z', '2022/04/01 01:00:12', '-', 'Finn Harps', 'Shamrock Rovers', 6.0, 1.66, '-', 1.75, 2.34], ['2022-04-01T20:00:00Z', '2022/04/01 01:00:13', '-', 'Deportivo Santani', 'Club F de la Mora', '-', '-', '-', '-', '-'], ['2022-04-01T18:45:00Z', '2022/04/01 01:00:14', '-', 'Bohemians', 'Derry City', 2.8, 2.88, 3.35, '-', '-'], ['2022-04-01T17:00:00Z', '2022/04/01 01:00:15', '-', 'FC Gleisdorf 09', 'RZ Pellets WAC (Am)', '-', '-', '-', '-', '-'], ['2022-04-01T16:00:00Z', '2022/04/01 01:00:16', '-', 'FK Velez Mostar', 'Siroki Brijeg', 2.24, 4.3, '-', 1.72, '-'], ['2022-04-01T14:00:00Z', '2022/04/01 01:00:16', '-', 'ASO Chlef', 'US Biskra', 1.8, 7.2, 3.15, '-', 2.86], ['2022-04-01T16:30:00Z', '2022/04/01 01:00:17', '-', 'FC Wacker Innsbruck', 'Floridsdorfer Ac', 2.34, 3.25, 3.8, '-', 1.95], ['2022-04-01T16:30:00Z', '2022/04/01 01:00:18', '-', 'SK Vorwarts Steyr', 'Austria Wien (A)', 2.48, 2.82, 3.9, '-', 1.88], ['2022-04-01T14:30:00Z', '2022/04/01 01:00:19', '-', 'MC Alger', 'Medea', 1.46, '-', '-', 1.72, 2.3], ['2022-04-01T16:30:00Z', '2022/04/01 01:00:20', '-', 'FC Juniors OO', 'SV Horn', 2.76, 2.58, 3.55, 2.1, 1.79], ['2022-04-01T17:30:00Z', '2022/04/01 01:00:21', '-', 'SV Worgl', 'SV Telfs I', '-', '-', '-', '-', '-'], ['2022-04-01T18:25:00Z', '2022/04/01 01:00:22', '-', 'Grazer AK', 'FC Blau Weiss Linz', '-', 2.1, 3.7, 1.99, '-'], ['2022-04-02T02:00:00Z', '2022/04/01 01:00:23', '-', 'San Luis', 'Mazatlan FC', 1.9, 5.3, 3.55, 1.6, 2.42], ['2022-04-01T14:30:00Z', '2022/04/01 01:00:24', '-', 'NC Magra', 'NA Hussein Dey', 2.3, '-', 2.72, 1.48, '-'], ['2022-04-01T16:30:00Z', '2022/04/01 01:00:25', '-', 'SKU Amstetten', 'SC AUSTRIA LUSTENAU', 3.45, 2.08, 4.1, '-', 1.63], ['2022-04-01T18:30:00Z', '2022/04/01 01:00:26', '-', 'Gent (W)', 'Femina WS (W)', '-', '-', '-', 3.9, '-'], ['2022-04-01T16:30:00Z', '2022/04/01 01:00:27', '-', 'SV Lafnitz', 'Ksv 1919', 1.53, 9.2, 4.9, '-', 1.76], ['2022-04-01T17:00:00Z', '2022/04/01 01:00:28', '-', 'Kabylie', 'USM Alger', 1.86, 7.4, 3.25, 1.48, 2.62], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:29', '-', 'FC Dordrecht', 'FC Eindhoven', 5.5, 1.72, 4.3, 2.42, 1.69], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:30', '-', 'Helmond Sport', 'MVV Maastricht', 2.06, 3.55, 4.1, 2.5, 1.59], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:31', '-', 'FC Volendam', 'FC Oss', 1.54, 6.8, 4.8, 2.68, 1.52], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:32', '-', 'Roda JC', 'Jong FC Utrecht', 1.31, 13.5, 6.6, 2.94, '-'], ['2022-04-01T14:15:00Z', '2022/04/01 01:00:33', '-', 'Fk Novi Pazar', 'FK Napredak', 2.68, 2.9, 3.3, 1.92, 2.16], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:34', '-', 'Jong AZ Alkmaar', 'Jong PSV Eindhoven', 3.65, 2.18, 3.9, 2.48, 1.67], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:35', '-', 'Almere City', 'Excelsior', 2.56, 2.72, 4.2, 2.62, 1.57], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:36', '-', 'NAC Breda', 'Jong Ajax Amsterdam', 2.42, 2.78, 4.5, 3.0, 1.44], ['2022-04-01T13:00:00Z', '2022/04/01 01:00:38', '-', 'Agudat Sport Ashdod', 'Bnei Yehuda', 2.58, 3.65, 3.0, '-', '-'], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:39', '-', 'De Graafschap', 'Emmen', 2.86, 2.8, 3.4, 1.79, 2.14], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:40', '-', 'VVV Venlo', 'ADO Den Haag', 2.9, 2.42, 4.0, 2.32, 1.76], ['2022-04-01T13:00:00Z', '2022/04/01 01:00:41', '-', 'Hapoel Akko', 'Hapoel Afula', '-', 3.45, 3.25, '-', '-'], ['2022-04-01T15:00:00Z', '2022/04/01 01:00:43', '-', 'Wolkite Ketema', 'Adama City FC', '-', 2.24, 3.0, '-', '-'], ['2022-04-01T12:00:00Z', '2022/04/01 01:00:44', '-', 'Defence Force SC', 'Arba Minch', '-', '-', 2.86, 1.46, '-'], ['2022-04-01T22:00:00Z', '2022/04/01 01:00:44', '-', 'Nacional Potosi', 'Aurora', 1.53, 9.2, 4.7, '-', 1.67], ['2022-04-02T00:30:00Z', '2022/04/01 01:00:46', '-', 'Blooming Santa Cruz', 'Always Ready', 2.24, 3.25, 3.75, 2.34, '-'], ['2022-04-01T18:45:00Z', '2022/04/01 01:00:47', '-', 'Galway Utd', 'Cobh Ramblers', 1.61, 8.0, '-', 2.12, 1.75], ['2022-04-01T18:45:00Z', '2022/04/01 01:00:48', '-', 'Athlone Town', 'Bray Wanderers', '-', 1.82, '-', 2.54, 1.64], ['2022-04-01T23:00:00Z', '2022/04/01 01:00:49', '-', 'CA Rentistas', 'Penarol', '-', 1.55, '-', 1.95, '-'], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:50', '-', 'Middlesbrough U23', 'Newcastle U23', '-', '-', '-', '-', '-'], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:51', '-', 'Nottm Forest U23', 'Wolves U23', 2.2, 3.6, 4.3, 2.66, '-'], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:52', '-', 'Reading U23', 'West Brom U23', '-', 1.91, '-', '-', '-'], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:53', '-', 'Norwich U23', 'Sunderland U23', 1.74, '-', '-', 2.88, '-'], ['2022-04-01T13:00:00Z', '2022/04/01 01:00:54', '-', 'Hapoel Umm AL Fahm', 'Sektzia Nes Tziona', '-', 2.56, 3.4, '-', '-'], ['2022-04-01T13:00:00Z', '2022/04/01 01:00:55', '-', 'Hapoel Rishon Lezion', 'Ironi Ramat HaSharon', 2.38, '-', 2.9, '-', '-'], ['2022-04-01T18:00:00Z', '2022/04/01 01:00:56', '-', 'Aston Villa U23', 'Stoke U23', '-', 2.46, 3.55, '-', '-'], ['2022-04-01T14:30:00Z', '2022/04/01 01:00:57', '-', 'NK Sesvete', 'Kustosija', 1.89, 4.7, '-', 1.79, '-'], ['2022-04-01T18:15:00Z', '2022/04/01 01:00:58', '-', 'Swieqi United FC', 'Marsa FC', '-', 1.9, 4.4, 2.2, 1.75], ['2022-04-01T17:00:00Z', '2022/04/01 01:00:59', '-', 'Leixoes', 'Penafiel', 2.06, 4.2, 3.4, '-', 2.22], ['2022-04-01T18:45:00Z', '2022/04/01 01:01:00', '-', 'Cliftonville', 'Crusaders', 2.32, '-', '-', '-', 1.98], ['2022-04-01T23:30:00Z', '2022/04/01 01:01:01', '-', 'OHiggins', 'Coquimbo Unido', 2.16, 4.1, '-', 1.77, '-'], ['2022-04-01T15:00:00Z', '2022/04/01 01:01:02', '-', 'San Gwann', 'Pembroke Athleta', '-', 1.75, 3.8, '-', '-'], ['2022-04-01T20:30:00Z', '2022/04/01 01:01:03', '-', 'La Serena', 'Everton De Vina', 3.4, 2.54, 3.2, 1.66, 2.26], ['2022-04-01T18:00:00Z', '2022/04/01 01:01:04', '-', 'SC Telstar', 'Den Bosch', 1.88, '-', '-', '-', 1.68], ['2022-04-01T12:00:00Z', '2022/04/01 01:01:05', '-', 'NK Dubrava Zagreb', 'Cibalia Vinkovci', 1.88, 5.2, '-', 1.78, '-'], ['2022-04-01T16:00:00Z', '2022/04/01 01:01:06', '-', 'Zamalek', 'G.D. Sagrada Esperanca', '-', '-', '-', 1.94, '-'], ['2022-04-01T19:00:00Z', '2022/04/01 01:01:07', '-', 'SS Reyes', 'Racing Santander', 4.2, 2.28, '-', 1.57, '-'], ['2022-04-01T16:00:00Z', '2022/04/01 01:01:08', '-', 'FC Kosice', 'Samorin', 1.6, '-', '-', 2.34, '-'], ['2022-04-01T18:00:00Z', '2022/04/01 01:01:09', '-', 'Anderlecht (W)', 'Club Brugge (W)', 1.26, '-', '-', '-', '-'], ['2022-04-01T15:00:00Z', '2022/04/01 01:01:10', '-', 'Podbrezova', 'FK Puchov', 1.41, 8.6, 5.6, 2.38, 1.6], ['2022-04-01T21:15:00Z', '2022/04/01 01:01:11', '-', 'Zamora FC', 'Mineros Guayana', 1.99, '-', 3.5, 1.73, '-'], ['2022-04-01T21:45:00Z', '2022/04/01 01:01:12', '-', 'CF America (W)', 'FC Juarez (W)', '-', '-', '-', '-', '-'], ['2022-04-01T23:30:00Z', '2022/04/01 01:01:13', '-', 'Deportivo La Guaira', 'Estudiantes de Merida', 2.18, 4.4, 3.25, '-', '-'], ['2022-04-01T19:00:00Z', '2022/04/01 01:01:14', '-', 'CD Castellon', 'Alcoyano', 2.16, '-', 3.15, '-', '-'], ['2022-04-01T19:00:00Z', '2022/04/01 01:01:15', '-', 'Metropolitanos', 'Carabobo FC', 2.3, 4.1, 3.0, 1.68, 2.56], ['2022-04-01T23:00:00Z', '2022/04/01 01:01:16', '-', 'Queretaro (W)', 'Club Tijuana (W)', '-', '-', '-', '-', 1.65], ['2022-04-02T02:30:00Z', '2022/04/01 01:01:17', '-', 'Deportivo Saprissa', 'Municipal Grecia', 1.63, '-', '-', 1.97, 1.92], ['2022-04-01T17:00:00Z', '2022/04/01 01:01:18', '-', 'Roskilde', 'Vanlose IF', 1.39, 9.0, 6.0, 2.92, 1.53], ['2022-04-01T17:00:00Z', '2022/04/01 01:01:19', '-', 'Hellerup IK', 'Akademisk Boldklub', '-', '-', '-', '-', '-'], ['2022-04-01T22:30:00Z', '2022/04/01 01:01:20', '-', 'Real Cartagena', 'Llaneros FC', 2.26, 3.7, 3.3, 1.72, 2.38], ['2022-04-01T12:30:00Z', '2022/04/01 01:01:21', '-', 'NK Orijent U19', 'NK Istra 1961 U19', '-', '-', '-', 2.2, '-'], ['2022-04-01T16:00:00Z', '2022/04/01 01:01:22', '-', 'Stal Mielec', 'Cracovia Krakow', 3.65, 2.36, 3.4, 1.68, '-'], ['2022-04-01T13:00:00Z', '2022/04/01 01:01:23', '-', 'Etoile Sportive Sahel', 'Jwaneng Galaxy FC', 1.11, 19.0, '-', 2.34, 1.68], ['2022-04-01T13:30:00Z', '2022/04/01 01:01:24', '-', 'HNK Sibenik U19', 'NK Varazdin U19', '-', '-', '-', 2.7, '-'], ['2022-04-01T16:00:00Z', '2022/04/01 01:01:25', '-', 'Horoya AC', 'AmaZulu', '-', '-', '-', 1.66, '-'], ['2022-04-01T18:30:00Z', '2022/04/01 01:01:26', '-', 'Slask Wroclaw', 'Lech Poznan', 6.2, 1.66, 3.85, 1.79, '-'], ['2022-04-01T16:30:00Z', '2022/04/01 01:01:27', '-', 'Riteriai', 'FK Jonava', '-', 36.0, 8.6, 2.4, 1.63], ['2022-04-01T11:45:00Z', '2022/04/01 01:01:28', '-', 'Hougang Utd', 'Albirex Niigata (SIN)', 8.2, 1.4, 7.6, 3.35, 1.36], ['2022-04-01T19:30:00Z', '2022/04/01 01:01:29', '-', 'Gimnasia La Plata', 'Talleres', 2.68, 3.0, 3.1, '-', 2.26], ['2022-04-01T17:00:00Z', '2022/04/01 01:01:30', '-', 'Babelsberg', 'Union Furstenwalde', 1.44, '-', '-', 2.44, '-'], ['2022-04-01T17:00:00Z', '2022/04/01 01:01:31', '-', 'VfB Homberg', 'Schalke 04 II', 4.9, 1.82, 3.9, 2.02, 1.88], ['2022-04-01T17:00:00Z', '2022/04/01 01:01:32', '-', 'Hertha Berlin II', 'VfB Auerbach', 1.49, '-', '-', 2.66, 1.58], ['2022-04-01T16:00:00Z', '2022/04/01 01:01:33', '-', 'FK Babrungas', 'FK Banga II', 1.75, '-', '-', 3.15, 1.47], ['2022-04-01T11:45:00Z', '2022/04/01 01:01:34', '-', 'Home Utd', 'Balestier Khalsa', 1.18, 23.0, 9.8, 2.2, 1.26], ['2022-04-01T10:00:00Z', '2022/04/01 01:01:35', '-', 'Fukuoka', 'Tosu', 2.62, 3.4, 3.0, 1.52, 2.92], ['2022-04-01T17:30:00Z', '2022/04/01 01:01:37', '-', 'Havnar Boltfelag II', 'Klaksvikar Itrottarfelag II', '-', 2.02, '-', '-', '-'], ['2022-04-01T19:15:00Z', '2022/04/01 01:01:38', '-', 'Stjarnan (W)', 'Breidablik (W)', '-', 1.92, '-', '-', '-'], ['2022-04-01T17:30:00Z', '2022/04/01 01:01:38', '-', 'Barmbek-Uhlenhorst', 'FC Suderelbe', '-', 1.95, '-', '-', 1.34], ['2022-04-01T22:00:00Z', '2022/04/01 01:01:39', '-', 'Central Cordoba (SdE)', 'Huracan', '-', '-', 3.15, 1.62, '-'], ['2022-04-02T00:30:00Z', '2022/04/01 01:01:41', '-', 'Banfield', 'Argentinos Juniors', 2.56, '-', '-', '-', '-'], ['2022-04-01T16:30:00Z', '2022/04/01 01:01:42', '-', 'Ingolstadt', 'Erzgebirge', 2.52, 2.94, 3.6, 2.1, 1.87], ['2022-04-02T00:00:00Z', '2022/04/01 01:01:43', '-', 'LD Alajuelense', 'Santos de Guapiles', 1.42, '-', '-', 2.2, '-'], ['2022-04-01T20:00:00Z', '2022/04/01 01:01:43', '-', 'CF Union Viera', 'Las Palmas C', 4.3, 2.48, 3.35, 1.78, '-'], ['2022-04-01T20:30:00Z', '2022/04/01 01:01:44', '-', 'Ayacucho Futbol Club', 'UTC Cajamarca', 2.08, 3.9, 3.8, 1.99, '-'], ['2022-04-01T03:01:19Z', '2022/04/01 01:01:45', '-', 'Santos Laguna (W)', 'Puebla FC (W)', 2.88, 4.5, 2.26, 1.12, 8.8], ['2022-04-01T18:00:00Z', '2022/04/01 01:01:46', '-', 'CD Pamplona', 'CD Huarte', 2.94, 2.64, 3.6, '-', '-'], ['2022-04-01T03:01:51Z', '2022/04/01 01:01:47', '-', 'Club Leon FC (W)', 'Cruz Azul (W)', 4.2, 3.15, 2.3, 3.2, 1.42], ['2022-04-01T02:33:13Z', '2022/04/01 01:01:48', '-', 'CS Cartagines', 'ADR Jicaral', 2.1, 11.5, 2.24, 1.07, 17.0], ['2022-04-01T18:00:00Z', '2022/04/01 01:01:49', '-', 'Birmingham (W)', 'Everton (W)', 5.3, 1.7, 3.95, '-', '-'], ['2022-04-01T17:00:00Z', '2022/04/01 01:01:50', '-', 'Illertissen', 'Unterhaching', 2.56, 2.84, 3.45, '-', '-'], ['2022-04-01T21:00:00Z', '2022/04/01 01:01:51', '-', 'AD Guanacasteca', 'Guadalupe F.C', '-', '-', '-', '-', '-'], ['2022-04-01T17:00:00Z', '2022/04/01 01:01:52', '-', 'SC Eltersdorf', 'TSV Rain/Lech', 2.32, 3.25, 4.0, 2.7, '-'], ['2022-04-01T17:30:00Z', '2022/04/01 01:01:53', '-', 'FC Memmingen', 'Viktoria Aschaffenburg', 2.84, 2.6, '-', 2.24, '-'], ['2022-04-01T18:00:00Z', '2022/04/01 01:01:54', '-', 'CD Gares', 'UDC Txantrea', '-', 1.46, '-', 2.42, '-'], ['2022-04-01T15:00:00Z', '2022/04/01 01:01:55', '-', 'Zilina', 'Ruzomberok', 2.48, 3.3, 3.75, 2.08, 1.83], ['2022-04-01T16:30:00Z', '2022/04/01 01:01:56', '-', 'Dynamo Dresden', 'Schalke 04', 4.9, 1.86, 3.85, 2.06, 1.82]]
                                                                                  
                                                                                      para_planilha.sort()
                                                                                  

                                                                                  I've seen some people indicating something like:

                                                                                  para_planilha = para_planilha.astype('str')
                                                                                  para_planilha.sort()
                                                                                  

                                                                                  But this error appears:

                                                                                  AttributeError: 'list' object has no attribute 'astype'
                                                                                  

                                                                                  How should I proceed to solve this problem and get sort this list?

                                                                                  ANSWER

                                                                                  Answered 2022-Apr-01 at 04:28

                                                                                  In base Python, we can try sorting using a lambda expression:

                                                                                  para_planilha.sort(key=lambda row: row[0])
                                                                                  

                                                                                  But note that you have some 1D lists in there whose first element is not a datetime string, such as [2.36, '-'], which appears first in the sort.

                                                                                  Source https://stackoverflow.com/questions/71701739

                                                                                  QUESTION

                                                                                  How can pathlib read_text() method display German Umlaute correctly on Windows 10 Enterprise?
                                                                                  Asked 2022-Mar-02 at 13:30

                                                                                  I have problems reading a text file textFile1 with the following content:

                                                                                  Das erste Mal war noch in der Audition-Phase bei einem Screentest. Sie haben mir das alte Kostüm von einem meiner Vorgänger, Val Kilmer, gegeben. Es war verrückt. Ich weiss noch genau, wie ich es mir angezogen habe und dachte, Batman zu spielen wird hier drinnen unmöglich sein für mich, völlig ausgeschlossen!

                                                                                  from pathlip import Path
                                                                                  p = Path('textFile1')
                                                                                  p.read_text()
                                                                                  

                                                                                  The language is German and some of the characters are not displayed correctly:

                                                                                  'Das erste Mal war noch in der Audition-Phase bei einem Screentest.\nSie haben mir das alte Kostüm von einem meiner Vorgänger, Val Kilmer, gegeben.\nEs war verrückt.\nIch weiss noch genau, wie ich es mir angezogen habe und dachte, Batman zu spielen wird hier drinnen unmöglich sein für mich, völlig ausgeschlossen!\n'

                                                                                  I came across this problem on another occasion when I tried to import a table into postgreSQL. A workaround was to enter the following from the command line:

                                                                                  chcp 1252
                                                                                  psql -U postgres
                                                                                  SET client_encoding='WIN1252'
                                                                                  \i Path/to/your/.sqlFile
                                                                                  

                                                                                  I am working on a Windows machine (Windows 10 Enterprise). Is there a way to solve the problem without changing the client_encoding every time I read text files from the command line? I have done quit a lot of research on this topic but I couldn't find a way to change the settings permanently. It seems to be a "Windows problem", because on my Mac all the characters are displayed correctly.

                                                                                  ANSWER

                                                                                  Answered 2022-Mar-02 at 13:30

                                                                                  p.read_text(encoding='UTF-8' )

                                                                                  Source https://stackoverflow.com/questions/71323243

                                                                                  QUESTION

                                                                                  Python f.seek and string slice yields different results
                                                                                  Asked 2022-Feb-04 at 12:07

                                                                                  I'm working on a small personal project of mine in Python which interprets an XML file as a script for a text-based console game. All the separate source files are merged into this one large XML file. In order not to use up too much memory by loading the contents of the entire file, I decided to use a separate JSON file as some sort of table of contents pointing to the various ? (including the tags themselves) tags.

                                                                                  This is an example of said table of contents: {"loremipsum1": [95, 366], "loremipsum3": [462, 283], "loremipsum_insamefile": [746, 62], "loremipsum2": [809, 603]}. The first value in [,] contains the starting character (well, supposedly) "<" and the second value contains the length of the scene itself. The XML itself does not matter, what matters is how to extract text blocks according to these two parameters.

                                                                                  95 is the length of the header; which is the length of *.

                                                                                  The method I was using involves something along the lines of:

                                                                                  # fcoords contain the [?,?] value in the table of contents
                                                                                  def parse_scene(readfile,fcoords):
                                                                                      readfile.seek(fcoords[0],0)
                                                                                      scene = readfile.read(fcoords[1])
                                                                                  # interpreter implementation would go here, but here's a print statement for now since it keeps on throwing errors
                                                                                      print(scene)
                                                                                  

                                                                                  Unfortunately it didn't work as planned, instead returning something like:

                                                                                  ========FSEEK========
                                                                                  nes>
                                                                                  
                                                                                  Lorem ipsum.
                                                                                  
                                                                                  
                                                                                  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                                                                                  Etiam cursus tempus ipsum vitae euismod. Suspendisse sit amet nulla in sem sagittis cursus.
                                                                                  
                                                                                  
                                                                                  Nullam sollicitudin
                                                                                  Ut tortor felis
                                                                                  
                                                                                  

                                                                                  After that I experimented a bit with the file, and used the following script to compare seek-read and read-slice; the output is different for the both of them, and not just a small difference of one or two characters at the front or back. It would drag out the post longer if I paste the differences so here is the script if you want to test it out.

                                                                                  Test Script

                                                                                  import json
                                                                                  # biblio.json contains the table of contents; feel free to replace this with just biblio = {}
                                                                                  with open("biblio.json",'r',encoding='utf-8') as f2:
                                                                                      biblio = json.load(f2)
                                                                                  # compiled.xml contains the .xml file attached at the bottom of the post
                                                                                  with open("compiled.xml",'r',encoding='utf-8') as f:
                                                                                      compiled_str = f.read()
                                                                                      for pair in biblio.items():
                                                                                          print("\033[92m========FSEEK========\033[0m")
                                                                                          f.seek(pair[1][0])
                                                                                          print(f.read(pair[1][1]))
                                                                                          print("\033[92m=======SLICE=========\033[0m")
                                                                                          print(compiled_str[pair[1][0]:pair[1][0]+pair[1][1]])
                                                                                          print("==========================================")
                                                                                  

                                                                                  Difference with Slice

                                                                                  =======SLICE=========
                                                                                  
                                                                                  Lorem ipsum.
                                                                                  
                                                                                  
                                                                                  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                                                                                  Etiam cursus tempus ipsum vitae euismod. Suspendisse sit amet nulla in sem sagittis cursus.
                                                                                  
                                                                                  
                                                                                  Nullam sollicitudin
                                                                                  Ut tortor felis
                                                                                  
                                                                                  
                                                                                  

                                                                                  Things I've tried:

                                                                                  1. Removed tabulations from the source during the merging process
                                                                                  2. Using Microsoft Word to check the characters with spaces and adding the number of lines to it since it doesn't count '\n'. Results vary, some of it matches perfectly with the second value of [,], some needs an increment or decrement.
                                                                                  3. Played around with how the merger counts the characters, doesn't seem to be wrong (I can provide the merger script if necessary)
                                                                                  4. Removed encoding="utf-8" from open() arguments, doesn't change anything.
                                                                                  5. Excluded the newline after the closing tag of each scene; and made sure that the scenes are separated by one (no overlap). seek-read still doesn't work.

                                                                                  Attached here is the XML file that was used.

                                                                                  
                                                                                  
                                                                                  ['Anonymous']
                                                                                  0.1.0
                                                                                  
                                                                                  
                                                                                  
                                                                                  Lorem ipsum.
                                                                                  
                                                                                  
                                                                                  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                                                                                  Etiam cursus tempus ipsum vitae euismod. Suspendisse sit amet nulla in sem sagittis cursus.
                                                                                  
                                                                                  
                                                                                  Nullam sollicitudin
                                                                                  Ut tortor felis
                                                                                  
                                                                                  
                                                                                  
                                                                                  
                                                                                  Fusce a rutrum ligula, vel fringilla ex.
                                                                                  Sed lobortis eu mauris non dictum. Fusce nec diam nec metus gravida consectetur vitae et nunc.
                                                                                  Aenean sed ullamcorper ipsum. Vivamus pharetra eros a erat cursus, eget euismod sapien lobortis.
                                                                                  
                                                                                  
                                                                                  
                                                                                  Hi.
                                                                                  
                                                                                  
                                                                                  Ut tortor felis, sodales a ipsum ac, semper molestie lacus.
                                                                                  Nunc faucibus ultrices nibh id porttitor. Phasellus sed tempus neque.
                                                                                  Vestibulum pulvinar
                                                                                  
                                                                                  Vestibulum pulvinar, odio egestas ullamcorper porta, massa tellus sodales ipsum, a porttitor elit lectus pharetra risus.
                                                                                  Quisque et congue justo. Integer in quam diam. Nunc id orci justo. Phasellus sed hendrerit dolor.
                                                                                  
                                                                                  
                                                                                  
                                                                                  
                                                                                  Lorem ipsum.
                                                                                  Ut tortor felis.
                                                                                  
                                                                                  
                                                                                  
                                                                                  
                                                                                  

                                                                                  Notes:

                                                                                  1. When the file is assembled, I use \n endings
                                                                                  2. I'm using Windows
                                                                                  3. All files are read with the UTF-8 encoding
                                                                                  4. I'm using Python 3.9.7

                                                                                  Question Why is the output different for both methods (seek-read and read-slice)?, and How do I make it so that I can find the scene properly without having to load up the entire file (it's small for now) into memory?

                                                                                  (also is it possible to have those shrinkable spoilers rather than the ones that just hides text so I can format this better, since the examples are taking up way too much space)

                                                                                  ANSWER

                                                                                  Answered 2022-Feb-04 at 12:07

                                                                                  It turns out that the line endings are indeed the problem in my case.

                                                                                  open(filename,mode,newline="") fixed it.

                                                                                  Here is a quote from the documentation for future reference.

                                                                                  newline controls how universal newlines mode works (it only applies to text mode). It can be None, '', '\n', '\r', and '\r\n'. It works as follows:

                                                                                  When reading input from the stream, if newline is None, universal newlines mode is enabled. Lines in the input can end in '\n', '\r', or '\r\n', and these are translated into '\n' before being returned to the caller. If it is '', universal newlines mode is enabled, but line endings are returned to the caller untranslated. If it has any of the other legal values, input lines are only terminated by the given string, and the line ending is returned to the caller untranslated.

                                                                                  When writing output to the stream, if newline is None, any '\n' characters written are translated to the system default line separator, os.linesep. If newline is '' or '\n', no translation takes place. If newline is any of the other legal values, any '\n' characters written are translated to the given string.

                                                                                  The table of contents was made using len() on the stringified version of the source files, which uses \n as its line ending, but it is later written to the compiled XML file, converting to \r\n. The extra \r's not present when the table of contents is formed seems to cause the offset.

                                                                                  (now I have to wait two days to accept my own answer huh)

                                                                                  Source https://stackoverflow.com/questions/70981597

                                                                                  QUESTION

                                                                                  JS regex to match zero-width position either loops forever or doesn't match at all
                                                                                  Asked 2022-Jan-27 at 03:05

                                                                                  Okay, so I have this string "nesˈo:tkʰo:x", and I want to get the index of all the zero-width positions that don't occur after any instance of the character ˈ (the IPA primary stress symbol). So in this case, those expected output would be 0, 1, 2, and 3 - the indices of the letters nes that occur before the one and only instance of ˈ, plus the ˈ itself.

                                                                                  I'm doing this with regex for reasons I'll get into in a bit. Regex101 confirms that /(?=.*?ˈ)/ should match all 4 of those zero-width positions with JS' regex flavor... but I can't actually get JS to return them.

                                                                                  A simple setup might look like this:

                                                                                  let teststring = "nesˈo:tkʰo:x";
                                                                                  let re = new RegExp("(?=.*?ˈ)", "g");
                                                                                  
                                                                                  while (result = re.exec(teststring)) {
                                                                                      console.log("Match found at "+result.index);
                                                                                  }
                                                                                  

                                                                                  ...except that this loops forever. It seems to get stuck on the first match, which I understand has something to do with how RegExp.exec is supposed to auto-increment RegExp.lastIndex for global regexes, or something. But I also can't make the regex not global, or it won't return all the matches for strings like this where more than one match is expected.

                                                                                  Okay, so what if I manually increment RegExp.lastIndex to prevent it from looping?

                                                                                  let teststring = "nesˈo:tkʰo:x";
                                                                                  let re = new RegExp("(?=.*?ˈ)", "g");
                                                                                  
                                                                                  while (result = re.exec(teststring)) {
                                                                                      if (result.index == re.lastIndex) {
                                                                                          re.lastIndex++;
                                                                                      } else {
                                                                                          console.log("Match found at "+result.index);
                                                                                      }
                                                                                  }

                                                                                  Now it... prints out nothing at all. Now, to be fair, if lastIndex starts at 0 by default, and the index of the first match is 0, I half expect that to be skipped over... but why isn't it at least giving me 1, 2 and 3 as matches?

                                                                                  Now, I can already hear the chorus of "you don't need regex for this, just do Array(teststring.indexOf("ˈ")).keys() or something to generate [0,1,2,3]". That may work for this specific example, but the actual use case is a parser function that's supposed to be a general solution for "for this input string, replace all instances of A with B, if condition C is true, unless condition D is true". Those conditions might be something like "if A is at the end of the string" or "if A is right next to another instance of A" or "if A is between 'n' and 't'". That kind of complicated string matching problem is why the parser creates and executes regexes on the fly and why regex is getting involved, and it does work for almost everything except this one annoying edge case, which I'd rather not have to refactor the entire mechanism of the parser to deal with if I don't have to.

                                                                                  ANSWER

                                                                                  Answered 2022-Jan-27 at 01:44

                                                                                  Use String.prototype.matchAll() to get all the matches.

                                                                                  let teststring = "nesˈo:tkʰo:x";
                                                                                  let re = new RegExp("(?=.*?ˈ)", "g");
                                                                                  
                                                                                  [...teststring.matchAll(re)].forEach(result =>
                                                                                    console.log("Match found at " + result.index)
                                                                                  )

                                                                                  Source https://stackoverflow.com/questions/70872269

                                                                                  QUESTION

                                                                                  Problem installing nes-py in WSL ubuntu using conda
                                                                                  Asked 2022-Jan-02 at 02:07

                                                                                  I was trying to install nes-py in WSL using pip install nes-py, but I got the following error (I am pasting the entire terminal message).

                                                                                  Collecting nes-py
                                                                                    Using cached nes_py-8.1.8.tar.gz (76 kB)
                                                                                  Requirement already satisfied: gym>=0.17.2 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (0.21.0)
                                                                                  Requirement already satisfied: numpy>=1.18.5 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (1.20.3)
                                                                                  Requirement already satisfied: pyglet<=1.5.11,>=1.4.0 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (1.5.11)
                                                                                  Requirement already satisfied: tqdm>=4.48.2 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from nes-py) (4.62.3)
                                                                                  Requirement already satisfied: cloudpickle>=1.2.0 in /home/aarav18/anaconda3/lib/python3.9/site-packages (from gym>=0.17.2->nes-py) (2.0.0)
                                                                                  Building wheels for collected packages: nes-py
                                                                                    Building wheel for nes-py (setup.py) ... error
                                                                                    ERROR: Command errored out with exit status 1:
                                                                                     command: /home/aarav18/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-84x8fqpu
                                                                                         cwd: /tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/
                                                                                    Complete output (27 lines):
                                                                                    running bdist_wheel
                                                                                    running build
                                                                                    running build_py
                                                                                    creating build
                                                                                    creating build/lib.linux-x86_64-3.9
                                                                                    creating build/lib.linux-x86_64-3.9/nes_py
                                                                                    copying nes_py/nes_env.py -> build/lib.linux-x86_64-3.9/nes_py
                                                                                    copying nes_py/_image_viewer.py -> build/lib.linux-x86_64-3.9/nes_py
                                                                                    copying nes_py/__init__.py -> build/lib.linux-x86_64-3.9/nes_py
                                                                                    copying nes_py/_rom.py -> build/lib.linux-x86_64-3.9/nes_py
                                                                                    creating build/lib.linux-x86_64-3.9/nes_py/app
                                                                                    copying nes_py/app/play_random.py -> build/lib.linux-x86_64-3.9/nes_py/app
                                                                                    copying nes_py/app/cli.py -> build/lib.linux-x86_64-3.9/nes_py/app
                                                                                    copying nes_py/app/play_human.py -> build/lib.linux-x86_64-3.9/nes_py/app
                                                                                    copying nes_py/app/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/app
                                                                                    creating build/lib.linux-x86_64-3.9/nes_py/wrappers
                                                                                    copying nes_py/wrappers/joypad_space.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
                                                                                    copying nes_py/wrappers/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
                                                                                    running build_ext
                                                                                    building 'nes_py.lib_nes_env' extension
                                                                                    creating build/temp.linux-x86_64-3.9
                                                                                    creating build/temp.linux-x86_64-3.9/nes_py
                                                                                    creating build/temp.linux-x86_64-3.9/nes_py/nes
                                                                                    creating build/temp.linux-x86_64-3.9/nes_py/nes/src
                                                                                    creating build/temp.linux-x86_64-3.9/nes_py/nes/src/mappers
                                                                                    g++ -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/aarav18/anaconda3/include -I/home/aarav18/anaconda3/include -fPIC -O2 -isystem /home/aarav18/anaconda3/include -fPIC -Ines_py/nes/include -I/home/aarav18/anaconda3/include/python3.9 -c nes_py/nes/src/cartridge.cpp -o build/temp.linux-x86_64-3.9/nes_py/nes/src/cartridge.o -std=c++1y -march=native -pipe -O3
                                                                                    error: command 'g++' failed: No such file or directory
                                                                                    ----------------------------------------
                                                                                    ERROR: Failed building wheel for nes-py
                                                                                    Running setup.py clean for nes-py
                                                                                  Failed to build nes-py
                                                                                  Installing collected packages: nes-py
                                                                                      Running setup.py install for nes-py ... error
                                                                                      ERROR: Command errored out with exit status 1:
                                                                                       command: /home/aarav18/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-kqt46_5n/install-record.txt --single-version-externally-managed --compile --install-headers /home/aarav18/anaconda3/include/python3.9/nes-py
                                                                                           cwd: /tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/
                                                                                      Complete output (27 lines):
                                                                                      running install
                                                                                      running build
                                                                                      running build_py
                                                                                      creating build
                                                                                      creating build/lib.linux-x86_64-3.9
                                                                                      creating build/lib.linux-x86_64-3.9/nes_py
                                                                                      copying nes_py/nes_env.py -> build/lib.linux-x86_64-3.9/nes_py
                                                                                      copying nes_py/_image_viewer.py -> build/lib.linux-x86_64-3.9/nes_py
                                                                                      copying nes_py/__init__.py -> build/lib.linux-x86_64-3.9/nes_py
                                                                                      copying nes_py/_rom.py -> build/lib.linux-x86_64-3.9/nes_py
                                                                                      creating build/lib.linux-x86_64-3.9/nes_py/app
                                                                                      copying nes_py/app/play_random.py -> build/lib.linux-x86_64-3.9/nes_py/app
                                                                                      copying nes_py/app/cli.py -> build/lib.linux-x86_64-3.9/nes_py/app
                                                                                      copying nes_py/app/play_human.py -> build/lib.linux-x86_64-3.9/nes_py/app
                                                                                      copying nes_py/app/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/app
                                                                                      creating build/lib.linux-x86_64-3.9/nes_py/wrappers
                                                                                      copying nes_py/wrappers/joypad_space.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
                                                                                      copying nes_py/wrappers/__init__.py -> build/lib.linux-x86_64-3.9/nes_py/wrappers
                                                                                      running build_ext
                                                                                      building 'nes_py.lib_nes_env' extension
                                                                                      creating build/temp.linux-x86_64-3.9
                                                                                      creating build/temp.linux-x86_64-3.9/nes_py
                                                                                      creating build/temp.linux-x86_64-3.9/nes_py/nes
                                                                                      creating build/temp.linux-x86_64-3.9/nes_py/nes/src
                                                                                      creating build/temp.linux-x86_64-3.9/nes_py/nes/src/mappers
                                                                                      g++ -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/aarav18/anaconda3/include -I/home/aarav18/anaconda3/include -fPIC -O2 -isystem /home/aarav18/anaconda3/include -fPIC -Ines_py/nes/include -I/home/aarav18/anaconda3/include/python3.9 -c nes_py/nes/src/cartridge.cpp -o build/temp.linux-x86_64-3.9/nes_py/nes/src/cartridge.o -std=c++1y -march=native -pipe -O3
                                                                                      error: command 'g++' failed: No such file or directory
                                                                                      ----------------------------------------
                                                                                  ERROR: Command errored out with exit status 1: /home/aarav18/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qez02o65/nes-py_a58dccafc96a4ee491ab6256d3849570/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-kqt46_5n/install-record.txt --single-version-externally-managed --compile --install-headers /home/aarav18/anaconda3/include/python3.9/nes-py Check the logs for full command output.
                                                                                  

                                                                                  I have tried many fixes, such as cloning the nes-py repo and installing it by running python setup.py install in its directory, changing the MANIFEST.in file, and some others, but nothing worked. If somebody can help in any way, that would be amazing!

                                                                                  Thanks in advance!

                                                                                  P.S. I am new to using both Conda and WSL/Ubuntu, so any help in that regard is appreciated as well. I used to just use cmd integrated with VS Code.

                                                                                  ANSWER

                                                                                  Answered 2022-Jan-02 at 02:07

                                                                                  Found the solution. Took a while, but it was a simple one. I just had to install g++ by running sudo apt install g++ in the terminal. After that, the nes-py installation worked like a charm.

                                                                                  Source https://stackoverflow.com/questions/70528648

                                                                                  QUESTION

                                                                                  Plotting hhmm (int) format time data on matplotlib polar graph
                                                                                  Asked 2021-Dec-22 at 03:35

                                                                                  I am plotting data which is currently formatted as integers (hhmm) as times of day onto a polar matplotlib graph and have come up with the dilemma that because of this integer format, I have gaps caused by the last 40 integers in every hundred never being plotted as in my data something like 1372 as 1:72, for example, doesn't make sense and doesn't exist.

                                                                                  I have three 'paths' the way I see it to fix this and those are; convert the hhmm data to proper time data to allow for easier plotting, temporarily changing the string value of the integer to 'stretch' over the hour or changing the x-axis of the graph to somehow omit the last 40 integers in every hundred.

                                                                                  I have tried the second by attempting to alter the last two characters in each of the hhmm values as strings and multiplying them by (5/3) to stretch them over the hour. This has come up with numerous problems like extra characters where they are not needed and bad handling of 0 when converted from string to int.

                                                                                  I figure that converting the data to a proper format is the best idea but I'm not even sure how I would go about performing this as I can only see an explanation of how to do this in SQL which I have no experience with.

                                                                                      # The code how it appears in my actual program is below
                                                                                  
                                                                                      # Clears any previous data
                                                                                      plt.clf()
                                                                                  
                                                                                      # Data that goes in via 'dataList'
                                                                                      dataList = [640, 641, 650, 703, 712, 740, 742, 756, 814, 816, 817, 820, 823, 824, 833, 839, 840, 850, 907, 910, 912, 914, 918, 918, 919, 922, 923, 925, 928, 929, 930, 932, 932, 935, 935, 936, 936, 936, 936, 938, 939, 941, 941, 941, 941, 942, 943, 943, 944, 945, 945, 946, 946, 948, 948, 948, 949, 949, 952, 952, 953, 953, 954, 956, 957, 958, 958, 1000, 1002, 1004, 1004, 1004, 1004, 1008, 1009, 1010, 1011, 1012, 1012, 1018, 1021, 1022, 1023, 1024, 1030, 1030, 1031, 1034, 1034, 1037, 1040, 1041, 1041, 1047, 1049, 1050, 1051, 1053, 1056, 1102, 1105, 1105, 1105, 1105, 1105, 1107, 1107, 1108, 1109, 1110, 1110, 1111, 1113, 1115, 1115, 1116, 1117, 1117, 1118, 1118, 1120, 1121, 1125, 1127, 1128, 1128, 1130, 1134, 1134, 1134, 1136, 1136, 1137, 1137, 1137, 1143, 1145, 1147, 1148, 1149, 1153, 1156, 1158, 1200, 1202, 1206, 1208, 1208, 1208, 1211, 1211, 1212, 1213, 1214, 1220, 1222, 1222, 1223, 1223, 1224, 1225, 1229, 1229, 1229, 1231, 1231, 1233, 1233, 1233, 1235, 1237, 1239, 1240, 1241, 1241, 1242, 1243, 1245, 1247, 1248, 1249, 1250, 1251, 1251, 1252, 1256, 1256, 1258, 1259, 1301, 1301, 1302, 1303, 1303, 1305, 1306, 1308, 1308, 1308, 1312, 1314, 1315, 1318, 1318, 1320, 1320, 1321, 1322, 1323, 1323, 1325, 1327, 1328, 1328, 1328, 1330, 1330, 1331, 1332, 1335, 1335, 1337, 1338, 1338, 1339, 1341, 1342, 1344, 1345, 1346, 1346, 1347, 1348, 1350, 1350, 1351, 1352, 1354, 1356, 1356, 1356, 1358, 1358, 1359, 1401, 1404, 1406, 1407, 1409, 1415, 1415, 1416, 1420, 1423, 1424, 1425, 1425, 1426, 1427, 1428, 1428, 1430, 1433, 1434, 1437, 1439, 1440, 1441, 1444, 1445, 1445, 1445, 1445, 1445, 1447, 1448, 1448, 1449, 1449, 1449, 1450, 1451, 1451, 1451, 1451, 1452, 1454, 1456, 1456, 1458, 1459, 1500, 1503, 1505, 1505, 1508, 1509, 1511, 1512, 1515, 1516, 1519, 1519, 1521, 1521, 1523, 1526, 1527, 1527, 1529, 1529, 1530, 1531, 1532, 1533, 1534, 1534, 1536, 1537, 1539, 1540, 1540, 1540, 1541, 1541, 1541, 1545, 1546, 1547, 1553, 1554, 1556, 1556, 1557, 1559, 1600, 1600, 1601, 1601, 1601, 1602, 1604, 1606, 1611, 1611, 1611, 1614, 1617, 1620, 1622, 1625, 1626, 1626, 1626, 1626, 1627, 1629, 1629, 1632, 1632, 1633, 1633, 1633, 1635, 1636, 1639, 1639, 1640, 1640, 1641, 1642, 1644, 1645, 1645, 1646, 1648, 1652, 1652, 1653, 1653, 1654, 1657, 1657, 1702, 1706, 1711, 1712, 1714, 1715, 1716, 1717, 1717, 1726, 1729, 1732, 1733, 1735, 1736, 1737, 1741, 1742, 1745, 1747, 1751, 1758, 1801, 1801, 1802, 1803, 1803, 1819, 1822, 1824, 1829, 1829, 1832, 1833, 1836, 1839, 1840, 1842, 1844, 1845, 1850, 1859, 1859, 1905, 1911, 1930, 1940, 2026, 2038, 2159, 2230, 2233]
                                                                                  
                                                                                      numColumns = ["temperature", "humidity", "#"]
                                                                                      f = Figure(figsize=(6, 6), dpi=100)
                                                                                      # Embedding plot onto Tkinter GUI
                                                                                      canvas = FigureCanvasTkAgg(f, master=frame)
                                                                                      canvas.get_tk_widget().grid(row=0, column=7, sticky='nes',
                                                                                                                  padx=(15, 15))
                                                                                  
                                                                                      if column == 'time':
                                                                                  
                                                                                          p = f.add_subplot(projection='polar')
                                                                                          angles = (np.array(dataList) / (20 / 3)) * pi / 180
                                                                                          p.bar(angles, np.full(len(dataList), 0.9), width=0.01,
                                                                                                bottom=0.89, linewidth=0)
                                                                                  
                                                                                          plt.setp(p.get_yticklabels(), visible=False)
                                                                                  
                                                                                          p.set_xticks(np.linspace(0, 2 * pi, 24, endpoint=False))
                                                                                          p.set_xticklabels(range(24))
                                                                                  
                                                                                          p.set_theta_direction(-1)
                                                                                  
                                                                                          p.set_theta_offset(pi / 2.0)
                                                                                  
                                                                                          plt.ylim(0, 1)
                                                                                  

                                                                                         # Code & data to reproduce the plot
                                                                                  
                                                                                         from matplotlib import pyplot as plt
                                                                                         from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
                                                                                         from matplotlib.figure import Figure
                                                                                         from numpy import pi
                                                                                      
                                                                                         root = Tk()
                                                                                         dataList = [640, 641, 650, 703, 712, 740, 742, 756, 814, 816, 817, 820, 823, 824, 833, 839, 840, 850, 907, 910, 912, 914, 918, 918, 919, 922, 923, 925, 928, 929, 930, 932, 932, 935, 935, 936, 936, 936, 936, 938, 939, 941, 941, 941, 941, 942, 943, 943, 944, 945, 945, 946, 946, 948, 948, 948, 949, 949, 952, 952, 953, 953, 954, 956, 957, 958, 958, 1000, 1002, 1004, 1004, 1004, 1004, 1008, 1009, 1010, 1011, 1012, 1012, 1018, 1021, 1022, 1023, 1024, 1030, 1030, 1031, 1034, 1034, 1037, 1040, 1041, 1041, 1047, 1049, 1050, 1051, 1053, 1056, 1102, 1105, 1105, 1105, 1105, 1105, 1107, 1107, 1108, 1109, 1110, 1110, 1111, 1113, 1115, 1115, 1116, 1117, 1117, 1118, 1118, 1120, 1121, 1125, 1127, 1128, 1128, 1130, 1134, 1134, 1134, 1136, 1136, 1137, 1137, 1137, 1143, 1145, 1147, 1148, 1149, 1153, 1156, 1158, 1200, 1202, 1206, 1208, 1208, 1208, 1211, 1211, 1212, 1213, 1214, 1220, 1222, 1222, 1223, 1223, 1224, 1225, 1229, 1229, 1229, 1231, 1231, 1233, 1233, 1233, 1235, 1237, 1239, 1240, 1241, 1241, 1242, 1243, 1245, 1247, 1248, 1249, 1250, 1251, 1251, 1252, 1256, 1256, 1258, 1259, 1301, 1301, 1302, 1303, 1303, 1305, 1306, 1308, 1308, 1308, 1312, 1314, 1315, 1318, 1318, 1320, 1320, 1321, 1322, 1323, 1323, 1325, 1327, 1328, 1328, 1328, 1330, 1330, 1331, 1332, 1335, 1335, 1337, 1338, 1338, 1339, 1341, 1342, 1344, 1345, 1346, 1346, 1347, 1348, 1350, 1350, 1351, 1352, 1354, 1356, 1356, 1356, 1358, 1358, 1359, 1401, 1404, 1406, 1407, 1409, 1415, 1415, 1416, 1420, 1423, 1424, 1425, 1425, 1426, 1427, 1428, 1428, 1430, 1433, 1434, 1437, 1439, 1440, 1441, 1444, 1445, 1445, 1445, 1445, 1445, 1447, 1448, 1448, 1449, 1449, 1449, 1450, 1451, 1451, 1451, 1451, 1452, 1454, 1456, 1456, 1458, 1459, 1500, 1503, 1505, 1505, 1508, 1509, 1511, 1512, 1515, 1516, 1519, 1519, 1521, 1521, 1523, 1526, 1527, 1527, 1529, 1529, 1530, 1531, 1532, 1533, 1534, 1534, 1536, 1537, 1539, 1540, 1540, 1540, 1541, 1541, 1541, 1545, 1546, 1547, 1553, 1554, 1556, 1556, 1557, 1559, 1600, 1600, 1601, 1601, 1601, 1602, 1604, 1606, 1611, 1611, 1611, 1614, 1617, 1620, 1622, 1625, 1626, 1626, 1626, 1626, 1627, 1629, 1629, 1632, 1632, 1633, 1633, 1633, 1635, 1636, 1639, 1639, 1640, 1640, 1641, 1642, 1644, 1645, 1645, 1646, 1648, 1652, 1652, 1653, 1653, 1654, 1657, 1657, 1702, 1706, 1711, 1712, 1714, 1715, 1716, 1717, 1717, 1726, 1729, 1732, 1733, 1735, 1736, 1737, 1741, 1742, 1745, 1747, 1751, 1758, 1801, 1801, 1802, 1803, 1803, 1819, 1822, 1824, 1829, 1829, 1832, 1833, 1836, 1839, 1840, 1842, 1844, 1845, 1850, 1859, 1859, 1905, 1911, 1930, 1940, 2026, 2038, 2159, 2230, 2233]
                                                                                      
                                                                                         f = Figure(figsize=(6, 6), dpi=100)
                                                                                         # Embedding plot onto Tkinter GUI
                                                                                         canvas = FigureCanvasTkAgg(f, master=root)
                                                                                         canvas.get_tk_widget().grid(row=0, column=7, sticky='nes',
                                                                                                                  padx=(15, 15))
                                                                                         p = f.add_subplot(projection='polar')
                                                                                         angles = (np.array(dataList) / (20 / 3)) * pi / 180
                                                                                         p.bar(angles, np.full(len(dataList), 0.9), width=0.01,
                                                                                            bottom=0.89, linewidth=0)
                                                                                         plt.setp(p.get_yticklabels(), visible=False)
                                                                                         p.set_xticks(np.linspace(0, 2 * pi, 24, endpoint=False))
                                                                                         p.set_xticklabels(range(24))
                                                                                         p.set_theta_direction(-1)
                                                                                         p.set_theta_offset(pi / 2.0)
                                                                                         plt.ylim(0, 1)
                                                                                      
                                                                                         root.mainloop()
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2021-Dec-22 at 03:32

                                                                                  Interpolating (spreading over an interval 0-100 i/o 0-60) the minutes in your dataset (keeping the hours as they are) produces the following plot, which I think alleviates the "gap" problem you mentioned.

                                                                                      from tkinter import *
                                                                                      import numpy as np
                                                                                      from matplotlib import pyplot as plt
                                                                                      from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
                                                                                      from matplotlib.figure import Figure
                                                                                      from numpy import pi
                                                                                      
                                                                                      
                                                                                      
                                                                                      def interpolate_clock_to_dec(val):
                                                                                          hours = (val // 100) * 100
                                                                                          minutes = val - hours
                                                                                          decimin = minutes / 60 * 100
                                                                                          return hours + decimin
                                                                                          
                                                                                      def convert_continuous(data):
                                                                                          converted = []
                                                                                          for val in data:
                                                                                              converted.append(interpolate_clock_to_dec(val))
                                                                                          return converted
                                                                                      
                                                                                      root = Tk()
                                                                                      dataList = [640, 641, 650, 703, 712, 740, 742, 756, 814, 816, 817, 820, 823, 824, 833, 839, 840, 850, 907, 910, 912, 914, 918, 918, 919, 922, 923, 925, 928, 929, 930, 932, 932, 935, 935, 936, 936, 936, 936, 938, 939, 941, 941, 941, 941, 942, 943, 943, 944, 945, 945, 946, 946, 948, 948, 948, 949, 949, 952, 952, 953, 953, 954, 956, 957, 958, 958, 1000, 1002, 1004, 1004, 1004, 1004, 1008, 1009, 1010, 1011, 1012, 1012, 1018, 1021, 1022, 1023, 1024, 1030, 1030, 1031, 1034, 1034, 1037, 1040, 1041, 1041, 1047, 1049, 1050, 1051, 1053, 1056, 1102, 1105, 1105, 1105, 1105, 1105, 1107, 1107, 1108, 1109, 1110, 1110, 1111, 1113, 1115, 1115, 1116, 1117, 1117, 1118, 1118, 1120, 1121, 1125, 1127, 1128, 1128, 1130, 1134, 1134, 1134, 1136, 1136, 1137, 1137, 1137, 1143, 1145, 1147, 1148, 1149, 1153, 1156, 1158, 1200, 1202, 1206, 1208, 1208, 1208, 1211, 1211, 1212, 1213, 1214, 1220, 1222, 1222, 1223, 1223, 1224, 1225, 1229, 1229, 1229, 1231, 1231, 1233, 1233, 1233, 1235, 1237, 1239, 1240, 1241, 1241, 1242, 1243, 1245, 1247, 1248, 1249, 1250, 1251, 1251, 1252, 1256, 1256, 1258, 1259, 1301, 1301, 1302, 1303, 1303, 1305, 1306, 1308, 1308, 1308, 1312, 1314, 1315, 1318, 1318, 1320, 1320, 1321, 1322, 1323, 1323, 1325, 1327, 1328, 1328, 1328, 1330, 1330, 1331, 1332, 1335, 1335, 1337, 1338, 1338, 1339, 1341, 1342, 1344, 1345, 1346, 1346, 1347, 1348, 1350, 1350, 1351, 1352, 1354, 1356, 1356, 1356, 1358, 1358, 1359, 1401, 1404, 1406, 1407, 1409, 1415, 1415, 1416, 1420, 1423, 1424, 1425, 1425, 1426, 1427, 1428, 1428, 1430, 1433, 1434, 1437, 1439, 1440, 1441, 1444, 1445, 1445, 1445, 1445, 1445, 1447, 1448, 1448, 1449, 1449, 1449, 1450, 1451, 1451, 1451, 1451, 1452, 1454, 1456, 1456, 1458, 1459, 1500, 1503, 1505, 1505, 1508, 1509, 1511, 1512, 1515, 1516, 1519, 1519, 1521, 1521, 1523, 1526, 1527, 1527, 1529, 1529, 1530, 1531, 1532, 1533, 1534, 1534, 1536, 1537, 1539, 1540, 1540, 1540, 1541, 1541, 1541, 1545, 1546, 1547, 1553, 1554, 1556, 1556, 1557, 1559, 1600, 1600, 1601, 1601, 1601, 1602, 1604, 1606, 1611, 1611, 1611, 1614, 1617, 1620, 1622, 1625, 1626, 1626, 1626, 1626, 1627, 1629, 1629, 1632, 1632, 1633, 1633, 1633, 1635, 1636, 1639, 1639, 1640, 1640, 1641, 1642, 1644, 1645, 1645, 1646, 1648, 1652, 1652, 1653, 1653, 1654, 1657, 1657, 1702, 1706, 1711, 1712, 1714, 1715, 1716, 1717, 1717, 1726, 1729, 1732, 1733, 1735, 1736, 1737, 1741, 1742, 1745, 1747, 1751, 1758, 1801, 1801, 1802, 1803, 1803, 1819, 1822, 1824, 1829, 1829, 1832, 1833, 1836, 1839, 1840, 1842, 1844, 1845, 1850, 1859, 1859, 1905, 1911, 1930, 1940, 2026, 2038, 2159, 2230, 2233]
                                                                                      
                                                                                      converted_data = convert_continuous(dataList)
                                                                                      
                                                                                      f = Figure(figsize=(6, 6), dpi=100)
                                                                                      # Embedding plot onto Tkinter GUI
                                                                                      canvas = FigureCanvasTkAgg(f, master=root)
                                                                                      canvas.get_tk_widget().grid(row=0, column=7, sticky='nes', padx=(15, 15))
                                                                                      p = f.add_subplot(projection='polar')
                                                                                      angles = (np.array(converted_data) / (20 / 3)) * pi / 180
                                                                                      p.bar(angles, np.full(len(converted_data), 0.9), width=0.01, bottom=0.89, linewidth=0)
                                                                                      plt.setp(p.get_yticklabels(), visible=False)
                                                                                      p.set_xticks(np.linspace(0, 2 * pi, 24, endpoint=False))
                                                                                      p.set_xticklabels(range(24))
                                                                                      p.set_theta_direction(-1)
                                                                                      p.set_theta_offset(pi / 2.0)
                                                                                      plt.ylim(0, 1)
                                                                                      plt.show()
                                                                                      
                                                                                      root.mainloop()
                                                                                  

                                                                                  Source https://stackoverflow.com/questions/70443564

                                                                                  QUESTION

                                                                                  Can this conditional be shortened?
                                                                                  Asked 2021-Dec-14 at 18:51

                                                                                  Is it possible to just use .get() function from dictionary for this? Is this the best we can do to shorten this piece of code?

                                                                                  n_dict is a Dict type (uppercase D) and NES is just a list of str

                                                                                  eted_info = {}
                                                                                  for key in n_dict:
                                                                                      if key in NES:
                                                                                          eted_info[key] = n_dict[key]
                                                                                  

                                                                                  I'm just curious if there is a better / more pythonic way to retrieve a value, like C# has with TryGetValue.

                                                                                  ANSWER

                                                                                  Answered 2021-Dec-14 at 02:04

                                                                                  You can do something with dictionary comprehension like this:

                                                                                  eted_info = {key: n_dict[key] for key in n_dict if key in NES}
                                                                                  

                                                                                  Source https://stackoverflow.com/questions/70342871

                                                                                  QUESTION

                                                                                  Getting Netlify build error when importing web3 in NextJS application - 'Error: Can't resolve 'electron' in...'
                                                                                  Asked 2021-Nov-23 at 14:09

                                                                                  I am building a web page that uses web3 to interact with Ethereum smart contracts. I am getting errors in the Netlify build whenever I import web3 into the page:

                                                                                  9:54:39 PM: ModuleNotFoundError: Module not found: Error: Can't resolve 'electron' in '/opt/build/repo/node_modules/swarm-js/node_modules/got'
                                                                                  9:54:39 PM: > Build error occurred
                                                                                  9:54:39 PM: Error: > Build failed because of webpack errors
                                                                                  

                                                                                  I can repro getting this error vs not getting it simply by adding the web3 import to the page:

                                                                                  import web3 from '../ethereum/web3'
                                                                                  

                                                                                  The above code is simply exporting an instantiated web3 instance from another file:

                                                                                  import Web3 from "web3";
                                                                                   
                                                                                  let web3;
                                                                                   
                                                                                  if (typeof window !== "undefined" && typeof window.ethereum !== "undefined") {
                                                                                    // We are in the browser and metamask is running.
                                                                                    window.ethereum.request({ method: "eth_requestAccounts" });
                                                                                    web3 = new Web3(window.ethereum);
                                                                                  } else {
                                                                                    // We are on the server *OR* the user is not running metamask
                                                                                    const provider = new Web3.providers.HttpProvider(
                                                                                      "https://mainnet.infura.io/v3/{INFURA_KEY}"
                                                                                    );
                                                                                    web3 = new Web3(provider);
                                                                                  }
                                                                                   
                                                                                  export default web3;
                                                                                  

                                                                                  I'm thinking this might have something to do with web3 being able to only run in the browser and NextJS doing some SSR, but I can't quite put my finger on the issue. Here's my full page code:

                                                                                  import Head from 'next/head'
                                                                                  import Header from '../components/Header'
                                                                                  import Menu from '../components/Menu'
                                                                                  import Footer from '../components/Footer'
                                                                                  import web3 from '../ethereum/web3'
                                                                                  const compiledFaucet = require('../ethereum/contracts/Faucet.json')
                                                                                  
                                                                                  
                                                                                  export default function Faucet() {
                                                                                    const getICHCHandler = () => {
                                                                                      console.log('dripping ICHC from faucet')
                                                                                    }
                                                                                  
                                                                                    return (
                                                                                      
                                                                                        
                                                                                          I Can Has Cheezburger Token
                                                                                          
                                                                                          
                                                                                          
                                                                                          {/* Global site tag (gtag.js) - Google Analytics */}
                                                                                          
                                                                                          
                                                                                        
                                                                                  
                                                                                        
                                                                                          
                                                                                          
                                                                                            ICHC Token Faucet
                                                                                            
                                                                                            
                                                                                              
                                                                                                Enter wallet address:
                                                                                                
                                                                                              
                                                                                              
                                                                                              Get ICHC Token
                                                                                            
                                                                                            
                                                                                          
                                                                                        
                                                                                  
                                                                                        
                                                                                  
                                                                                        
                                                                                  
                                                                                        
                                                                                      
                                                                                    )
                                                                                  }
                                                                                  
                                                                                  export async function getServerSideProps(ctx) {
                                                                                    const faucetContract = new web3.eth.Contract(
                                                                                      compiledFaucet.abi,
                                                                                      "0x4099E633A607F6ED211e2c82565003d6F755e75e"
                                                                                    )
                                                                                  return { faucetContract }
                                                                                  }
                                                                                  
                                                                                  

                                                                                  Thanks for any tips or suggestions.

                                                                                  ANSWER

                                                                                  Answered 2021-Nov-23 at 14:09

                                                                                  For anyone else facing this issue, here's what ultimately worked for me after much research.

                                                                                  It seems to be a Webpack issue where a conditional / inline import of 'electron' in one of the web3 dependency of a dependency is improperly not ignored. The solution was to explicitly ignore electron in the next.config.js file like this:

                                                                                  /**
                                                                                   * @type {import('next').NextConfig}
                                                                                   */
                                                                                  
                                                                                   const nextConfig = {
                                                                                      webpack: (config, { webpack }) => {
                                                                                          config.plugins.push(new webpack.IgnorePlugin({
                                                                                              resourceRegExp: /^electron$/
                                                                                          }),);
                                                                                          return config
                                                                                      }
                                                                                    }
                                                                                    
                                                                                    module.exports = nextConfig
                                                                                  

                                                                                  Source https://stackoverflow.com/questions/69888765

                                                                                  Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                                                                                  Vulnerabilities

                                                                                  No vulnerabilities reported

                                                                                  Install nes

                                                                                  The go get command will automatically fetch the dependencies listed above, compile the binary and place it in your $GOPATH/bin directory.

                                                                                  Support

                                                                                  Interested in writing your own emulator? Curious about the NES internals? Here are some good resources:.
                                                                                  Find more information at:
                                                                                  Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                  Find more libraries
                                                                                  Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                  Save this library and start creating your kit
                                                                                  CLONE
                                                                                • HTTPS

                                                                                  https://github.com/fogleman/nes.git

                                                                                • CLI

                                                                                  gh repo clone fogleman/nes

                                                                                • sshUrl

                                                                                  git@github.com:fogleman/nes.git

                                                                                • Share this Page

                                                                                  share link

                                                                                  Explore Related Topics

                                                                                  Consider Popular Video Game Libraries

                                                                                  Proton

                                                                                  by ValveSoftware

                                                                                  ArchiSteamFarm

                                                                                  by JustArchiNET

                                                                                  MinecraftForge

                                                                                  by MinecraftForge

                                                                                  byte-buddy

                                                                                  by raphw

                                                                                  nes

                                                                                  by fogleman

                                                                                  Try Top Libraries by fogleman

                                                                                  primitive

                                                                                  by foglemanGo

                                                                                  Craft

                                                                                  by foglemanC

                                                                                  Minecraft

                                                                                  by foglemanPython

                                                                                  gg

                                                                                  by foglemanGo

                                                                                  ln

                                                                                  by foglemanGo

                                                                                  Compare Video Game Libraries with Highest Support

                                                                                  Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                  Find more libraries
                                                                                  Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                  Save this library and start creating your kit