SOXAI Data Science Library
Project description
soxai_data Python Package
This package provides a data loader for SOXAI ring users to access and analyze their data.
Installation
Install the package using pip:
pip install soxai_data
Usage
First, obtain your token by logging into the SOXAI Platform. After logging in, generate your token and use it to load the data.
Initialize DataLoader
from soxai_data import DataLoader
# Initialize the DataLoader with your token
sx_data = DataLoader(token='your_token')
Get Daily Data
You can retrieve daily data and plot it as follows:
# Retrieve daily data
df = sx_data.getDailyData()
# Plot the data
df.plot()
Get Account Information
To get your account information:
# Retrieve account information
my_info = sx_data.getMyInfo()
print(my_info)
Get Organization Users
If you have an organization ID, you can get the users associated with it:
# Retrieve organization users
my_org_id = my_info['myOrg']['orgId']
org_df = sx_data.getMyOrgUsers(my_org_id)
print(org_df)
Merge DataFrames
You can merge the data with organization user information based on a common field:
# Merge daily data with organization user data
merged_df = df.merge(org_df, on='uid', how='left')
print(merged_df)
Get Detail Data
To retrieve detailed data within a specified date range:
# Retrieve detailed data
detail_df = sx_data.getDetailData(start_date='2023-01-01', end_date='2023-01-31')
print(detail_df)
Complete Example
Here's a complete example that includes retrieving and merging data:
from soxai_data import DataLoader
# Initialize the DataLoader
sx_data = DataLoader(token='your_token')
# Get daily data
df = sx_data.getDailyData()
# Get account information
my_info = sx_data.getMyInfo()
my_org_id = my_info['myOrg']['orgId']
# Get organization users
org_df = sx_data.getMyOrgUsers(my_org_id)
# Merge data
merged_df = df.merge(org_df, on='uid', how='left')
# Display the merged DataFrame
print(merged_df)
Methods
DataLoader.getMyInfo()
Retrieves the account information.
Returns:
dict
: My personal information.
DataLoader.getMyOrgUsers(org_id=None)
Retrieves the users associated with the specified organization.
Parameters:
org_id
(str, optional): The ID of the organization. If not provided, the method will use the default organization ID.
Returns:
pandas.DataFrame
: The DataFrame containing the users associated with the specified organization.
DataLoader.getDailyData(start_date=None, end_date=None, convert_to_local_time=True)
Retrieves daily data from the SOXAI database within the specified date range.
Parameters:
start_date
(str, optional): The start date of the data range. Defaults to '-7d'.end_date
(str, optional): The end date of the data range. Defaults to 'now()'.convert_to_local_time
(bool, optional): Whether to convert the time to local time. Defaults to True.
Returns:
pandas.DataFrame
: A DataFrame containing the retrieved data.
DataLoader.getDetailData(start_date=None, end_date=None, convert_to_local_time=True)
Retrieves detailed data from the SOXAI database within the specified date range.
Parameters:
start_date
(str, optional): The start date of the data range. Defaults to '-1d'.end_date
(str, optional): The end date of the data range. Defaults to 'now()'.convert_to_local_time
(bool, optional): Whether to convert the time to local time. Defaults to True.
Returns:
pandas.DataFrame
: A DataFrame containing the retrieved data.
Additional Notes
- Ensure your token is valid and has not expired.
- Handle exceptions and errors gracefully while making API calls.
- Utilize Pandas' powerful data manipulation capabilities to analyze and visualize your data efficiently.
By following this guide, you should be able to effectively use the soxai_data
package to retrieve, analyze, and visualize data from the SOXAI platform.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file soxai_data-0.0.3.tar.gz
.
File metadata
- Download URL: soxai_data-0.0.3.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45a81e41720750e3026e34020324b22be8981decee85f9a3656138083a168ead |
|
MD5 | f653ff4f95ae89224b0243bf4ac34372 |
|
BLAKE2b-256 | 780940f246927b4d5d895afe552192ee7a92f5424b976f82764e769084b266c0 |
Provenance
The following attestation bundles were made for soxai_data-0.0.3.tar.gz
:
Publisher:
deploy.yml
on soxaidev/soxai_data
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
soxai_data-0.0.3.tar.gz
- Subject digest:
45a81e41720750e3026e34020324b22be8981decee85f9a3656138083a168ead
- Sigstore transparency entry: 150447505
- Sigstore integration time:
- Predicate type:
File details
Details for the file soxai_data-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: soxai_data-0.0.3-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1edafce8212e160fb989b0a7fc2429789c4806e04bc57b9ed56a81e7a2baa2f4 |
|
MD5 | 86aa81d407040674136b7e4b64b67b09 |
|
BLAKE2b-256 | f72a1bf1c7eec4af261019ba7acda7c8416323c669f3e2b0f12c2d4d769ed0dc |
Provenance
The following attestation bundles were made for soxai_data-0.0.3-py3-none-any.whl
:
Publisher:
deploy.yml
on soxaidev/soxai_data
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
soxai_data-0.0.3-py3-none-any.whl
- Subject digest:
1edafce8212e160fb989b0a7fc2429789c4806e04bc57b9ed56a81e7a2baa2f4
- Sigstore transparency entry: 150447506
- Sigstore integration time:
- Predicate type: