Skip to main content

khulnasoft-pandas

A helper library to pull data from khulnasoft api into a pandas dataframe.

pypi package CI

Install

pip install khulnasoft-pandas

Documentation

More detailed documentation can be found at https://khulnasoft.github.io/khulnasoft-pandas

Quickstart

Get some data into a pandas dataframe.

from khulnasoft_pandas.data import get_data

df = get_data('london.my-khulnasoft.com', ['system.cpu','system.load'], after=-60, before=0)
print(df.shape)
print(df.head())
(60, 12)
            system.cpu|guest  system.cpu|guest_nice  system.cpu|iowait  \
time_idx                                                                 
1604928205               0.0                    0.0                0.0   
1604928206               0.0                    0.0                0.0   
1604928207               0.0                    0.0                0.0   
1604928208               0.0                    0.0                0.0   
1604928209               0.0                    0.0                0.0   

            system.cpu|irq  system.cpu|nice  system.cpu|softirq  \
time_idx                                                          
1604928205             0.0              0.0                 0.0   
1604928206             0.0              0.0                 0.0   
1604928207             0.0              0.0                 0.0   
1604928208             0.0              0.0                 0.0   
1604928209             0.0              0.0                 0.0   

            system.cpu|steal  system.cpu|system  system.cpu|user  \
time_idx                                                           
1604928205          0.000000           0.501253         0.501253   
1604928206          0.000000           0.753769         0.502513   
1604928207          0.000000           0.505050         0.505050   
1604928208          0.000000           0.751880         0.501253   
1604928209          0.251256           0.251256         0.502513   

            system.load|load1  system.load|load15  system.load|load5  
time_idx                                                              
1604928205               0.03                 0.0               0.04  
1604928206               0.03                 0.0               0.04  
1604928207               0.03                 0.0               0.04  
1604928208               0.03                 0.0               0.04  
1604928209               0.03                 0.0               0.04  

An alternative way to call get_data() is to define what hosts and charts you want via the host_charts_dict param:

# define list of charts for each host you want data for
host_charts_dict = {
    "london.my-khulnasoft.com" : ['system.io','system.ip'],
    "newyork.my-khulnasoft.com" : ['system.io','system.net'],
}
df = get_data(host_charts_dict=host_charts_dict, host_prefix=True)
print(df.shape)
print(df.head())
(61, 8)
            london.my-khulnasoft.com::system.io|in  \
time_idx                                         
1604928340                                 NaN   
1604928341                                 0.0   
1604928342                                 0.0   
1604928343                                 0.0   
1604928344                                 0.0   

            london.my-khulnasoft.com::system.io|out  \
time_idx                                          
1604928340                                  NaN   
1604928341                            -53.89722   
1604928342                            -26.10278   
1604928343                              0.00000   
1604928344                              0.00000   

            london.my-khulnasoft.com::system.ip|received  \
time_idx                                               
1604928340                                       NaN   
1604928341                                  49.25227   
1604928342                                 227.22840   
1604928343                                 123.56787   
1604928344                                  31.99060   

            london.my-khulnasoft.com::system.ip|sent  \
time_idx                                           
1604928340                                   NaN   
1604928341                             -51.85469   
1604928342                             -85.22854   
1604928343                             -43.00154   
1604928344                             -19.55536   

            newyork.my-khulnasoft.com::system.io|in  \
time_idx                                          
1604928340                                  0.0   
1604928341                                  0.0   
1604928342                                  0.0   
1604928343                                  0.0   
1604928344                                  0.0   

            newyork.my-khulnasoft.com::system.io|out  \
time_idx                                           
1604928340                              0.000000   
1604928341                             -6.545929   
1604928342                             -9.454071   
1604928343                              0.000000   
1604928344                              0.000000   

            newyork.my-khulnasoft.com::system.net|received  \
time_idx                                                 
1604928340                                   13.778033   
1604928341                                   18.281470   
1604928342                                   24.811770   
1604928343                                   26.406000   
1604928344                                   26.457510   

            newyork.my-khulnasoft.com::system.net|sent  
time_idx                                            
1604928340                               -16.97193  
1604928341                               -19.23857  
1604928342                               -76.86994  
1604928343                              -165.55492  
1604928344                              -115.83034  

Examples

You can find some more examples in the examples folder.

Or if you just want to play with it right now you can use this Google Colab notebook to quickly get started.

Metadata

Release files for khulnasoft-pandas 0.0.46

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for khulnasoft-pandas 0.0.46
File Size Uploaded
khulnasoft_pandas-0.0.46.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for khulnasoft-pandas 0.0.46
File Interpreter ABI Platform
khulnasoft_pandas-0.0.46-py3-none-any.whl Python 3 none any Details

Total release size: 31.1 kB

Release files / khulnasoft_pandas-0.0.46.tar.gz

Download URL khulnasoft_pandas-0.0.46.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8236ce1ece34f1f28619c658eb216c95badb52e5b47eeb52e0c60fa962949b7d
BLAKE2b-256 checksum
How to use checksums
8df19f0792a94b3ec3c66b6ab8a5a6aeb6e9ccf09cdf1ec8316165d0e19c2666
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / khulnasoft_pandas-0.0.46-py3-none-any.whl

Download URL khulnasoft_pandas-0.0.46-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e6bf701c3d3972c3c4d8e705581c6c9ced1d7e156103e1cc426266ed5f22c49
BLAKE2b-256 checksum
How to use checksums
eeb6365d9d79443168d17c2083ba91301fde3aef72db7785753b6ad905eaff5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.0.46 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page