Skip to main content
Quarantined

This project has been quarantined by PyPI admins. It cannot be installed or modified until a security review is complete.

welcome to Kang digital magic world: V0.3:calculate_weighted_value thank you for your trust. if you have any questions, please contact me. kangxiaowen@gmail.com

首先,创建两个DataFrame:一个是活动水平序列,另一个是权重序列。请看以下的Python代码:

import pandas as pd
import kanglib
import matplotlib.pyplot as plt

# 创建一个日期范围
dates = pd.date_range(start='2022-01-01', periods=365)

# 创建活动水平DataFrame
activity_levels_df = pd.DataFrame({
    'date': dates,
    'activity_level': [0.2] * len(dates)
})

# 创建权重DataFrame
weights_df = pd.DataFrame({
    'date': dates,
    'weight': [0.5] * len(dates)
})

# 合并这两个DataFrame
df = pd.merge(activity_levels_df, weights_df, on='date')

# 使用calculate_weighted_value函数
df = kanglib.calculate_weighted_value(df, ['activity_level'], 'weight', 'result')

# 打印DataFrame
print(df)

# 绘制结果
plt.plot(df['date'], df['result'])
plt.title('Weighted Activity Level over Time')
plt.xlabel('Date')
plt.ylabel('Weighted Activity Level')
plt.show()

这段代码首先创建了两个DataFrame,一个包含活动水平,另一个包含权重,都是针对相同的日期范围。然后,它们被合并到同一个DataFrame中,然后使用calculate_weighted_value函数计算加权活动水平。然后它打印出这个DataFrame,并将结果列绘制成一条折线图,x轴是日期,y轴是加权活动水平。


python setup.py sdist bdist_wheel

twine upload dist/*


使用示例

下面是如何使用 kanglib.calculate_weighted_value 函数的示例:

import pandas as pd
import kanglib
import matplotlib.pyplot as plt
import numpy as np

# 创建一个日期范围
dates = pd.date_range(start='2022-01-01', periods=365*2)

# 创建活动水平DataFrame
activity_levels_df = pd.DataFrame({
    'date': dates,
    'activity_level': np.random.rand(len(dates))
})

# 创建权重DataFrame
weights_df = pd.DataFrame({
    'date': dates,
    'weight': np.random.rand(len(dates))
})

# 合并这两个DataFrame
df = pd.merge(activity_levels_df, weights_df, on='date')

# 使用calculate_weighted_value函数
df = kanglib.calculate_weighted_value(df, ['activity_level'], 'weight', 'result')

# 打印DataFrame
print(df)

# 绘制结果
plt.plot(df['date'], df['result'])
plt.title('Weighted Activity Level over Time')
plt.xlabel('Date')
plt.ylabel('Weighted Activity Level')
plt.show()

Metadata

Release files for kanglib 0.5

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

Source distribution (sdist)

Source distribution for kanglib 0.5
File Size Uploaded Provenance Actions
kanglib-0.5.tar.gz 2.7 kB Without provenance Details for kanglib-0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kanglib 0.5
File Interpreter ABI Platform Actions
kanglib-0.5-py3-none-any.whl Python 3 none any Details for kanglib-0.5-py3-none-any.whl

Total release size: 5.7 kB

Release files / kanglib-0.5.tar.gz

Download URL kanglib-0.5.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4954d982876892234e24816610889173fc1a66100630104e5336bce412cd75df
BLAKE2b-256 checksum
How to use checksums
0774e23141921f22e1a3449edd05eef3b6b9c67b4e7e155c131db644e1957c18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / kanglib-0.5-py3-none-any.whl

Download URL kanglib-0.5-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
225107ceb92fdb6704639d6c220038d276a017e0e24cdaed3e0671660994f385
BLAKE2b-256 checksum
How to use checksums
771a18bc1879c8081b1d90d7bfa95cbff6ca86a948df5ce7e07ab0b5490e0822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Security for kanglib 0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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