py2ls 0.2.4.24__py3-none-any.whl → 0.2.4.26__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- py2ls/.DS_Store +0 -0
- py2ls/.git/index +0 -0
- py2ls/corr.py +475 -0
- py2ls/data/.DS_Store +0 -0
- py2ls/data/hyper_param_autogluon_zeroshot2024.json +2383 -0
- py2ls/data/styles/.DS_Store +0 -0
- py2ls/data/styles/example/.DS_Store +0 -0
- py2ls/data/usages_sns.json +6 -1
- py2ls/ec2ls.py +61 -0
- py2ls/ips.py +496 -138
- py2ls/ml2ls.py +994 -288
- py2ls/netfinder.py +16 -20
- py2ls/nl2ls.py +283 -0
- py2ls/plot.py +1244 -158
- {py2ls-0.2.4.24.dist-info → py2ls-0.2.4.26.dist-info}/METADATA +5 -1
- {py2ls-0.2.4.24.dist-info → py2ls-0.2.4.26.dist-info}/RECORD +17 -14
- py2ls/data/usages_pd copy.json +0 -1105
- py2ls/ml2ls copy.py +0 -2906
- {py2ls-0.2.4.24.dist-info → py2ls-0.2.4.26.dist-info}/WHEEL +0 -0
py2ls/data/styles/.DS_Store
CHANGED
Binary file
|
Binary file
|
py2ls/data/usages_sns.json
CHANGED
@@ -22,5 +22,10 @@
|
|
22
22
|
"pairplot": "seaborn.pairplot(data,*,hue=None,hue_order=None,palette=None,vars=None,x_vars=None,y_vars=None,kind='scatter',diag_kind='auto',markers=None,height=2.5,aspect=1,corner=False,dropna=False,plot_kws=None,diag_kws=None,grid_kws=None,size=None)\nhttps://seaborn.pydata.org/generated/seaborn.pairplot.html",
|
23
23
|
"jointplot": "seaborn.jointplot(data=None,*,x=None,y=None,hue=None,kind='scatter',height=6,ratio=5,space=0.2,dropna=False,xlim=None,ylim=None,color=None,palette=None,hue_order=None,hue_norm=None,marginal_ticks=False,joint_kws=None,marginal_kws=None,**kwargs)\nhttps://seaborn.pydata.org/generated/seaborn.jointplot.html",
|
24
24
|
"plotting_context": "seaborn.plotting_context(context=None,font_scale=1,rc=None)\nhttps://seaborn.pydata.org/generated/seaborn.plotting_context.html",
|
25
|
-
"swarmplot":"seaborn.swarmplot(data=None, *, x=None, y=None, hue=None, order=None, hue_order=None, dodge=False, orient=None, color=None, palette=None, size=5, edgecolor=None, linewidth=0, hue_norm=None, log_scale=None, native_scale=False, formatter=None, legend='auto', warn_thresh=0.05, ax=None, **kwargs)\nhttps://seaborn.pydata.org/generated/seaborn.swarmplot.html"
|
25
|
+
"swarmplot":"seaborn.swarmplot(data=None, *, x=None, y=None, hue=None, order=None, hue_order=None, dodge=False, orient=None, color=None, palette=None, size=5, edgecolor=None, linewidth=0, hue_norm=None, log_scale=None, native_scale=False, formatter=None, legend='auto', warn_thresh=0.05, ax=None, **kwargs)\nhttps://seaborn.pydata.org/generated/seaborn.swarmplot.html",
|
26
|
+
"ellipse":"ellipse(data=df,x='Dim1',y='Dim2',hue='Group',confidence=0.95,palette=get_color(8),alpha=0.1,lw=2,**kwargs)",
|
27
|
+
"heatmap":"seaborn.heatmap(data, *, vmin=None, vmax=None, cmap=None, center=None, robust=False, annot=None, fmt='.2g', annot_kws=None, linewidths=0, linecolor='white', cbar=True, cbar_kws=None, cbar_ax=None, square=False, xticklabels='auto', yticklabels='auto', mask=None, ax=None, **kwargs)\nhttps://seaborn.pydata.org/generated/seaborn.heatmap.html",
|
28
|
+
"clustermap":"seaborn.clustermap(data, *, pivot_kws=None, method='average', metric='euclidean', z_score=None, standard_scale=None, figsize=(10, 10), cbar_kws=None, row_cluster=True, col_cluster=True, row_linkage=None, col_linkage=None, row_colors=None, col_colors=None, mask=None, dendrogram_ratio=0.2, colors_ratio=0.03, cbar_pos=(0.02, 0.8, 0.05, 0.18), tree_kws=None, **kwargs)\nhttps://seaborn.pydata.org/generated/seaborn.clustermap.html",
|
29
|
+
"FaceGrid":"seaborn.FacetGrid(data, *, row=None, col=None, hue=None, col_wrap=None, sharex=True, sharey=True, height=3, aspect=1, palette=None, row_order=None, col_order=None, hue_order=None, hue_kws=None, dropna=False, legend_out=True, despine=True, margin_titles=False, xlim=None, ylim=None, subplot_kws=None, gridspec_kws=None)\nhttps://seaborn.pydata.org/generated/seaborn.FacetGrid.html",
|
30
|
+
"PairGrid":"seaborn.PairGrid(data, *, hue=None, vars=None, x_vars=None, y_vars=None, hue_order=None, palette=None, hue_kws=None, corner=False, diag_sharey=True, height=2.5, aspect=1, layout_pad=0.5, despine=True, dropna=False)\nhttps://seaborn.pydata.org/generated/seaborn.PairGrid.html"
|
26
31
|
}
|
py2ls/ec2ls.py
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
def get_trend(
|
2
|
+
keywords: list = None, # ["AI", "Python", "Data Science"]
|
3
|
+
timezone: str = "Europe/Berlin", # minutes differ from UTC
|
4
|
+
cat=0,
|
5
|
+
timeframe="today 12-m",
|
6
|
+
geo="DE",
|
7
|
+
gprop="",
|
8
|
+
**kwargs
|
9
|
+
):
|
10
|
+
from pytrends.request import TrendReq
|
11
|
+
from pytrends.exceptions import TooManyRequestsError
|
12
|
+
import pytz
|
13
|
+
from datetime import datetime
|
14
|
+
import time
|
15
|
+
import requests
|
16
|
+
from urllib3.util.retry import Retry
|
17
|
+
|
18
|
+
if isinstance(timezone, str):
|
19
|
+
stadt = pytz.timezone(timezone)
|
20
|
+
current_time = datetime.now(stadt) # This will be timezone-aware
|
21
|
+
# Convert the timezone-aware datetime to naive UTC datetime
|
22
|
+
naive_time = current_time.astimezone(pytz.utc).replace(tzinfo=None)
|
23
|
+
tz_offset = stadt.utcoffset(naive_time).seconds // 60 # in minutes
|
24
|
+
elif isinstance(timezone, int):
|
25
|
+
tz_offset = timezone
|
26
|
+
|
27
|
+
# Initialize TrendReq with correct timezone offset
|
28
|
+
pytrends = TrendReq(hl="en-US", tz=tz_offset )
|
29
|
+
|
30
|
+
# Ensure that keywords are in list form
|
31
|
+
if isinstance(keywords, str):
|
32
|
+
keywords = [keywords]
|
33
|
+
|
34
|
+
pytrends.build_payload(keywords, cat=cat, timeframe=timeframe, geo=geo, gprop=gprop)
|
35
|
+
|
36
|
+
res = {}
|
37
|
+
# Try fetching data with error handling
|
38
|
+
for func_name, fetch_func in [
|
39
|
+
("interest_over_time", pytrends.interest_over_time),
|
40
|
+
("related_topics", pytrends.related_topics),
|
41
|
+
("related_queries", pytrends.related_queries),
|
42
|
+
("categories", pytrends.categories)
|
43
|
+
]:
|
44
|
+
try:
|
45
|
+
print(f"Fetching {func_name}...")
|
46
|
+
res[func_name] = fetch_func()
|
47
|
+
print(f"done: {func_name}")
|
48
|
+
except TooManyRequestsError:
|
49
|
+
print(f"Too many requests error for {func_name}. Retrying...")
|
50
|
+
time.sleep(5) # Delay to avoid spamming the server
|
51
|
+
if retries > 0:
|
52
|
+
return get_trend(keywords, timezone, cat, timeframe, geo, gprop, retries=retries-1)
|
53
|
+
res[func_name] = None
|
54
|
+
except requests.exceptions.RequestException as e:
|
55
|
+
print(f"Request error for {func_name}: {e}")
|
56
|
+
res[func_name] = None
|
57
|
+
except Exception as e:
|
58
|
+
print(f"Error fetching {func_name}: {e}")
|
59
|
+
res[func_name] = None
|
60
|
+
|
61
|
+
return res
|