imsciences 0.9.5.8__py3-none-any.whl → 0.9.5.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of imsciences might be problematic. Click here for more details.
- imsciences/mmm.py +24 -1
- {imsciences-0.9.5.8.dist-info → imsciences-0.9.5.9.dist-info}/METADATA +1 -1
- {imsciences-0.9.5.8.dist-info → imsciences-0.9.5.9.dist-info}/RECORD +7 -7
- {imsciences-0.9.5.8.dist-info → imsciences-0.9.5.9.dist-info}/LICENSE.txt +0 -0
- {imsciences-0.9.5.8.dist-info → imsciences-0.9.5.9.dist-info}/PKG-INFO-IMS-24Ltp-3 +0 -0
- {imsciences-0.9.5.8.dist-info → imsciences-0.9.5.9.dist-info}/WHEEL +0 -0
- {imsciences-0.9.5.8.dist-info → imsciences-0.9.5.9.dist-info}/top_level.txt +0 -0
imsciences/mmm.py
CHANGED
|
@@ -1554,4 +1554,27 @@ class dataprocessing:
|
|
|
1554
1554
|
"combined_features": combined_features,
|
|
1555
1555
|
}
|
|
1556
1556
|
|
|
1557
|
-
return output
|
|
1557
|
+
return output
|
|
1558
|
+
|
|
1559
|
+
def quid_pr (self, df):
|
|
1560
|
+
def convert_date(date_str):
|
|
1561
|
+
try:
|
|
1562
|
+
return datetime.strptime(date_str, '%b %d, %Y')
|
|
1563
|
+
except ValueError:
|
|
1564
|
+
return None # Return None if conversion fails
|
|
1565
|
+
# Apply conversion to create new columns
|
|
1566
|
+
df['Start Date'] = df['Earliest Published'].astype(str).apply(convert_date)
|
|
1567
|
+
df['End Date'] = df['Latest Published'].astype(str).apply(convert_date)
|
|
1568
|
+
df['Days Duration'] = (df['End Date'] - df['Start Date']).dt.days + 1 # Ensure inclusive range
|
|
1569
|
+
df['Count per Day'] = df['Published Count'] / df['Days Duration'] # Calculate count per day
|
|
1570
|
+
df['Social Engagement per Day'] = df['Social Engagement'] / df['Days Duration']
|
|
1571
|
+
df['Week Start'] = df['Start Date'].apply(lambda x: x - timedelta(days=x.weekday()) if pd.notnull(x) else None)
|
|
1572
|
+
count_df = df.groupby('Week Start')['Count per Day'].sum().reset_index()
|
|
1573
|
+
total_engagement_per_company = df.groupby('Company (Primary Mention)')['Social Engagement'].sum().reset_index() # Caluclates Social Engagement across whole period
|
|
1574
|
+
valid_companies = total_engagement_per_company[total_engagement_per_company['Social Engagement'] > 0]['Company (Primary Mention)'] # Filters out Companies with no Social Engagement
|
|
1575
|
+
social_engagement_df = df[df['Company (Primary Mention)'].isin(valid_companies)].groupby(['Week Start', 'Company (Primary Mention)'])[
|
|
1576
|
+
'Social Engagement'
|
|
1577
|
+
].sum().reset_index()
|
|
1578
|
+
total_social_engagement_df = df.groupby('Week Start')['Social Engagement per Day'].sum().reset_index()
|
|
1579
|
+
|
|
1580
|
+
return count_df, total_social_engagement_df, social_engagement_df
|
|
@@ -6,7 +6,7 @@ imsciences/datafunctions-IMS-24Ltp-3.py,sha256=3Snv-0iE_03StmyjtT-riOU9f4v8TaJWL
|
|
|
6
6
|
imsciences/datafunctions.py,sha256=WZrXNLO-SYrCuFt0pAbha74psMOZPY7meWJ7yWEbRpk,169953
|
|
7
7
|
imsciences/datapull.py,sha256=TPY0LDgOkcKTBk8OekbD0Grg5x0SomAK2dZ7MuT6X1E,19000
|
|
8
8
|
imsciences/geo.py,sha256=eenng7_BP_E2WD5Wt1G_oNxQS8W3t6lycRwJ91ngysY,15808
|
|
9
|
-
imsciences/mmm.py,sha256=
|
|
9
|
+
imsciences/mmm.py,sha256=qMh0ccOepehfCcux7EeG8cq6piSEoFEz5iiJbDBWOS4,82214
|
|
10
10
|
imsciences/pull.py,sha256=8j4k9hnQ9IuxY8W_PvO6afutPm4Pz_SJRjZfU47qxX0,81654
|
|
11
11
|
imsciences/unittesting.py,sha256=U177_Txg0Lqn49zYRu5bl9OVe_X7MkNJ6V_Zd6DHOsU,45656
|
|
12
12
|
imsciences/vis.py,sha256=2izdHQhmWEReerRqIxhY4Ai10VjL7xoUqyWyZC7-2XI,8931
|
|
@@ -14,9 +14,9 @@ imsciencesdataprocessing/__init__.py,sha256=quSwsLs6IuLoA5Rzi0ZD40xZaQudwDteF7_a
|
|
|
14
14
|
imsciencesdataprocessing/datafunctions.py,sha256=vE1vsZ8xOSbR9Bwlp9SWXwEHXQ0nFydwGkvzHXf2f1Y,41
|
|
15
15
|
imsdataprocessing/__init__.py,sha256=quSwsLs6IuLoA5Rzi0ZD40xZaQudwDteF7_ai9JfTPk,32
|
|
16
16
|
imsdataprocessing/datafunctions.py,sha256=vE1vsZ8xOSbR9Bwlp9SWXwEHXQ0nFydwGkvzHXf2f1Y,41
|
|
17
|
-
imsciences-0.9.5.
|
|
18
|
-
imsciences-0.9.5.
|
|
19
|
-
imsciences-0.9.5.
|
|
20
|
-
imsciences-0.9.5.
|
|
21
|
-
imsciences-0.9.5.
|
|
22
|
-
imsciences-0.9.5.
|
|
17
|
+
imsciences-0.9.5.9.dist-info/LICENSE.txt,sha256=lVq2QwcExPX4Kl2DHeEkRrikuItcDB1Pr7yF7FQ8_z8,1108
|
|
18
|
+
imsciences-0.9.5.9.dist-info/METADATA,sha256=3sC4oZfBBk5try5pxgpcPlFXb7RLEx6xgTbLpVdQB7c,18846
|
|
19
|
+
imsciences-0.9.5.9.dist-info/PKG-INFO-IMS-24Ltp-3,sha256=yqZbigwHjnYoqyI81PGz_AeofRFfOrwH_Vyawyef-mg,854
|
|
20
|
+
imsciences-0.9.5.9.dist-info/WHEEL,sha256=ixB2d4u7mugx_bCBycvM9OzZ5yD7NmPXFRtKlORZS2Y,91
|
|
21
|
+
imsciences-0.9.5.9.dist-info/top_level.txt,sha256=hsENS-AlDVRh8tQJ6-426iUQlla9bPcGc0-UlFF0_iU,11
|
|
22
|
+
imsciences-0.9.5.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|