Skip to main content

Collection of utils for making your life easier when using the Python data science stack

Project description

python-ds-util

PyPI version

Installation

The library is available on pip:

pip install dsutil

Examples

For full usage examples see notebooks under the examples directory.

Plotting

Full examples for plotting here

  • add_grid(): reasonable default grid settings, with weak grey lines, light alpha, etc.

    import numpy as np
    import matplotlib.pyplot as plt
    from dsutil.plotting import add_grid
    
    x = np.linspace(0.0,100,10)
    y = np.random.uniform(low=0,high=10,size=10)
    
    plt.bar(x,y)
    
    add_grid()
    

  • add_value_labels() annotates barplots, line plots and scatter plots with values for the coordinates

    import numpy as np
    import matplotlib.pyplot as plt
    from dsutil.plotting import add_value_labels
    
    x = np.linspace(0.0,100,10)
    y = np.random.uniform(low=0,high=10,size=10)
    
    plt.bar(x,y)
    
    add_value_labels()
    

  • format_yaxis_percentage(): turns values between 0 and 1 in y-axis into percentages

    import numpy as np
    import matplotlib.pyplot as plt
    from dsutil.plotting import format_yaxis_percentage
    
    x = np.linspace(0.0,100,10)
    y = np.random.uniform(low=0,high=1,size=10)
    
    plt.bar(x,y)
    plt.yticks(np.arange(0,1.01,0.1))
    
    format_yaxis_percentage()
    

  • format_yaxis_thousands(): uses commas as thousands separator in the y-axis labels

    import numpy as np
    import matplotlib.pyplot as plt
    from dsutil.plotting import format_yaxis_thousands
    
    x = np.linspace(0.0,100,10)
    y = np.random.uniform(low=10000,high=100000,size=10)
    
    plt.bar(x,y)
    plt.yticks(np.arange(0,100001,10000))
    
    format_yaxis_thousands()
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dsutil-0.2.1.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

dsutil-0.2.1-py3-none-any.whl (8.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page