Skip to content

jtn-ms/awesome-python-again

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

Meta

News

Docker

Under-Check

Conversion

Scraping

Network

DataBase

Auto

Data & Time

File/Dir Processing

  • files with specific pattern in a folder

    glob.glob(subpath_+'\\*'+pattern+'*.j*pg')
    
  • files including one-sub-dir or not

    glob.iglob(subpath_+'\\**\\' + '*'+category+'*.j*pg', recursive=True)
    

Utility

  • pyinstaller : how2exclude : how-to-decrease-exe-size: pandas-conda2pip : pyqt5-exe-making : how-to-exclude

    This is the one and only choice for tensorflow-based application distribution and works great. But, you have to install python using brew not anaconda for Mac.
    
    $ pyinstaller  --onefile --windowed xxx.py
    # the following code help decreasing pkg size
    Analysis(..., excludes=['_gtkagg', '_tkagg', 'bsddb', 'curses', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl', 'Tkconstants', 'Tkinter', 'PyQt5','zmq'], ..)
    # the following code after Analyssi(...) help pandas works while using pyinstaller
    # it's better to use pip pandas than conda pandas for pkg size. conda pandas needs more than 400MB extra weight.
    def get_pandas_path():
    import pandas
    pandas_path = pandas.__path__[0]
    return pandas_path
    
    dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
    a.datas += dict_tree
    a.binaries = filter(lambda x: 'pandas' not in x[0], a.binaries)
    
    $ pyinstaller xxx.spec
    
  • cx_Freeze

    import sys
    from cx_Freeze import setup, Executable
    build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
    base = None
    if sys.platform == "win32":
        base = "Win32GUI"
    
    setup(  name = "guifoo",
            version = "0.1",
            description = "My GUI application!",
            options = {"build_exe": build_exe_options},
            executables = [Executable("guifoo.py", base=base)])
    

Dependency-Check

  • pipdeptree

    $ pipdeptree
    $ pipdeptree --reverse --packages itsdangerous,gnureadline
    #$ pip freeze
    #$ conda env list
    

GUI

Bot

  • ChatBot

     * ChatterBot

3D

Guide

python-guide

Fake Data Generator

  • faker

    from faker import Faker
    fake = Faker('en_US')
    fake.name()
    # 'Lucy Cechtelar'
    fake.address()
    # "426 Jordy Lodge
    #  Cartwrightshire, SC 88120-6700"
    fake.text()
    # Sint velit eveniet. Rerum atque repellat voluptatem quia rerum. Numquam excepturi
    # beatae sint laudantium consequatur. Magni occaecati itaque sint et sit tempore. Nesciunt
    # amet quidem. Iusto deleniti cum autem ad quia aperiam.
    # A consectetur quos aliquam. In iste aliquid et aut similique suscipit. Consequatur qui
    # quaerat iste minus hic expedita. Consequuntur error magni et laboriosam. Aut aspernatur
    # voluptatem sit aliquam. Dolores voluptatum est.
    # Aut molestias et maxime. Fugit autem facilis quos vero. Eius quibusdam possimus est.
    # Ea quaerat et quisquam. Deleniti sunt quam. Adipisci consequatur id in occaecati.
    # Et sint et. Ut ducimus quod nemo ab voluptatum.
    
  • mimesis

    from mimesis import Personal
    from mimesis.enums import Gender
    person = Personal('en')
    person.full_name(gender=Gender.FEMALE)
    person.occupation()
    templates = ['U_d', 'U-d', 'l_d', 'l-d']
    for template in templates:
      person.username(template=template)
    Personal('de').full_name()
    from mimesis import Generic
    from mimesis.enums import TLDType
    g = Generic('es')
    g.datetime.month()
    g.food.fruit()
    g.internet.top_level_domain(TLDType.GEOTLD)
    
  • gen_db.py

Cryptography

  • cryptography

    from cryptography.fernet import Fernet
    # Put this somewhere safe!
    key = Fernet.generate_key()
    f = Fernet(key)
    token = f.encrypt(b"A really secret message. Not for prying eyes.")
    token
    '...'
    f.decrypt(token)
    'A really secret message. Not for prying eyes.'
    

Debug

Data Science

Data Visualization

Web

Framework

 - [ ] [wsgi](http://wsgi.readthedocs.io/en/latest/frameworks.html)  

  • webpy

    "Django lets you write web apps in Django. TurboGears lets you write web apps in TurboGears. Web.py lets you write web apps in Python."
      —  Adam Atlas
      
    $ pip install web.py
    
    import web
    urls = ( '/(.*)', 'hello')
    app = web.application(urls, globals())
    class hello:  
      def GET(self, name):
        if not name: 
          name = 'World'
        return 'Hello, ' + name + '!'
    if __name__ == "__main__":
      app.run()
    
  • falcon

  • aiohttp:Client/Server

Django-Case

Flask-Case

Utility

Machine Learning

DataSet

Overview

NLP

  • spacy : src : models

    import spacy
    nlp = spacy.load('en')
    doc1 = nlp(u'the fries were gross')
    doc2 = nlp(u'worst fries ever')
    doc1.similarity(doc2)
    
  • gensim

  • newspaper:request+lxml+nltk+jieba

    py3$ pip install newspaper3k
    py2$ pip install newspaper
    from newspaper import Article
    url = 'http://fox13now.com/2013/12/30/new-year-new-laws-obamacare-pot-guns-and-drones/'
    article = Article(url)
    article.download()
    article.parse()
    article.authors
    article.publish_date
    article.text
    article.top_image
    article.movies
    article.nlp()
    article.keywords
    article.summary
    from newspaper import fulltext
    html = requests.get(...).text
    text = fulltext(html)
    
  • TextBlob

  • translate.py

  • summarize

Prediction

  • prophet : Quick-Start

    import pandas as pd
    import numpy as np
    from fbprophet import Prophet
    df = pd.read_csv('../examples/example_wp_peyton_manning.csv')
    df['y'] = np.log(df['y'])
    df.head()
    m = Prophet()
    m.fit(df)
    

Recommendation

Computer Vision

Super Resolution

Office

Excel

Releases

No releases published

Packages

 
 
 

Languages