imsciences 0.9.5.1__tar.gz → 0.9.5.2__tar.gz
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.
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/PKG-INFO +1 -1
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences/geo.py +13 -11
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences.egg-info/PKG-INFO +1 -1
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/setup.py +1 -1
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/LICENSE.txt +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/README.md +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences/__init__.py +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences/mmm.py +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences/pull.py +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences/unittesting.py +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences/vis.py +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences.egg-info/PKG-INFO-IMS-24Ltp-3 +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences.egg-info/SOURCES.txt +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences.egg-info/dependency_links.txt +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences.egg-info/requires.txt +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/imsciences.egg-info/top_level.txt +0 -0
- {imsciences-0.9.5.1 → imsciences-0.9.5.2}/setup.cfg +0 -0
|
@@ -199,13 +199,13 @@ class geoprocessing:
|
|
|
199
199
|
|
|
200
200
|
return analysis_df
|
|
201
201
|
|
|
202
|
-
def process_city_analysis(self,
|
|
202
|
+
def process_city_analysis(self, raw_data, spend_data, output_path, group1, group2, response_column):
|
|
203
203
|
"""
|
|
204
204
|
Process city analysis by grouping data, analyzing user metrics, and merging with spend data.
|
|
205
205
|
|
|
206
206
|
Parameters:
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
raw_data (str or pd.DataFrame): Raw input data as a file path (CSV/XLSX) or DataFrame.
|
|
208
|
+
spend_data (str or pd.DataFrame): Spend data as a file path (CSV/XLSX) or DataFrame.
|
|
209
209
|
output_path (str): Path to save the final output file (CSV or XLSX).
|
|
210
210
|
group1 (list): List of city regions for group 1.
|
|
211
211
|
group2 (list): List of city regions for group 2.
|
|
@@ -217,13 +217,15 @@ class geoprocessing:
|
|
|
217
217
|
import pandas as pd
|
|
218
218
|
import os
|
|
219
219
|
|
|
220
|
-
def read_file(
|
|
221
|
-
"""Helper function to
|
|
222
|
-
|
|
220
|
+
def read_file(data):
|
|
221
|
+
"""Helper function to handle file paths or return DataFrame directly."""
|
|
222
|
+
if isinstance(data, pd.DataFrame):
|
|
223
|
+
return data
|
|
224
|
+
ext = os.path.splitext(data)[1].lower()
|
|
223
225
|
if ext == '.csv':
|
|
224
|
-
return pd.read_csv(
|
|
226
|
+
return pd.read_csv(data)
|
|
225
227
|
elif ext in ['.xlsx', '.xls']:
|
|
226
|
-
return pd.read_excel(
|
|
228
|
+
return pd.read_excel(data)
|
|
227
229
|
else:
|
|
228
230
|
raise ValueError("Unsupported file type. Please use a CSV or XLSX file.")
|
|
229
231
|
|
|
@@ -237,9 +239,9 @@ class geoprocessing:
|
|
|
237
239
|
else:
|
|
238
240
|
raise ValueError("Unsupported file type. Please use a CSV or XLSX file.")
|
|
239
241
|
|
|
240
|
-
# Read
|
|
241
|
-
raw_df = read_file(
|
|
242
|
-
spend_df = read_file(
|
|
242
|
+
# Read data
|
|
243
|
+
raw_df = read_file(raw_data)
|
|
244
|
+
spend_df = read_file(spend_data)
|
|
243
245
|
|
|
244
246
|
# Ensure necessary columns are present
|
|
245
247
|
required_columns = {'date', 'city', response_column}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|