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.2.tar.gz
.
File metadata
- Download URL: soxai_data-0.0.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1723cf3b2b2ea576e3fbefe6a304802861f482f6a81f3f14e8f357a41b1864c0 |
|
MD5 | 1dd9ae0ca5028f4df7c7aa914ce080da |
|
BLAKE2b-256 | 548091fdcf042a282bdd3d82b043f6023f4e931e6a3da6dc90eccd224e747a9c |
File details
Details for the file soxai_data-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: soxai_data-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff7d035ae8ec9601a68e21bd9d058f89ef760edfea9d711c5c509080ad0991ac |
|
MD5 | f1a3655e4c454cd3047ee75dc191ec44 |
|
BLAKE2b-256 | 612136a9e23a7cffe1c7cf1e3c88b8f91c67c5688e56ed47a29c4c26c34a15c3 |