edsl 0.1.39.dev6__py3-none-any.whl → 0.1.39.dev8__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.
- edsl/__version__.py +1 -1
- edsl/agents/Agent.py +1 -1
- edsl/scenarios/FileStore.py +32 -0
- edsl/scenarios/handlers/csv.py +11 -0
- {edsl-0.1.39.dev6.dist-info → edsl-0.1.39.dev8.dist-info}/METADATA +2 -2
- {edsl-0.1.39.dev6.dist-info → edsl-0.1.39.dev8.dist-info}/RECORD +8 -8
- {edsl-0.1.39.dev6.dist-info → edsl-0.1.39.dev8.dist-info}/LICENSE +0 -0
- {edsl-0.1.39.dev6.dist-info → edsl-0.1.39.dev8.dist-info}/WHEEL +0 -0
edsl/__version__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.1.39.
|
1
|
+
__version__ = "0.1.39.dev8"
|
edsl/agents/Agent.py
CHANGED
@@ -906,7 +906,7 @@ class Agent(Base):
|
|
906
906
|
{'traits': {'age': 10, 'hair': 'brown', 'height': 5.5}, 'instruction': 'Have fun.', 'edsl_version': '...', 'edsl_class_name': 'Agent'}
|
907
907
|
"""
|
908
908
|
d = {}
|
909
|
-
d["traits"] = copy.deepcopy(self.
|
909
|
+
d["traits"] = copy.deepcopy(dict(self._traits))
|
910
910
|
if self.name:
|
911
911
|
d["name"] = self.name
|
912
912
|
if self.set_instructions:
|
edsl/scenarios/FileStore.py
CHANGED
@@ -327,6 +327,38 @@ class FileStore(Scenario):
|
|
327
327
|
|
328
328
|
return ConstructDownloadLink(self).create_link(custom_filename, style)
|
329
329
|
|
330
|
+
def to_pandas(self):
|
331
|
+
"""
|
332
|
+
Convert the file content to a pandas DataFrame if supported by the file handler.
|
333
|
+
|
334
|
+
Returns:
|
335
|
+
pandas.DataFrame: The data from the file as a DataFrame
|
336
|
+
|
337
|
+
Raises:
|
338
|
+
AttributeError: If the file type's handler doesn't support pandas conversion
|
339
|
+
"""
|
340
|
+
handler = FileMethods.get_handler(self.suffix)
|
341
|
+
if handler and hasattr(handler, "to_pandas"):
|
342
|
+
return handler(self.path).to_pandas()
|
343
|
+
raise AttributeError(
|
344
|
+
f"Converting {self.suffix} files to pandas DataFrame is not supported"
|
345
|
+
)
|
346
|
+
|
347
|
+
def __getattr__(self, name):
|
348
|
+
"""
|
349
|
+
Delegate pandas DataFrame methods to the underlying DataFrame if this is a CSV file
|
350
|
+
"""
|
351
|
+
if self.suffix == "csv":
|
352
|
+
# Get the pandas DataFrame
|
353
|
+
df = self.to_pandas()
|
354
|
+
# Check if the requested attribute exists in the DataFrame
|
355
|
+
if hasattr(df, name):
|
356
|
+
return getattr(df, name)
|
357
|
+
# If not a CSV or attribute doesn't exist in DataFrame, raise AttributeError
|
358
|
+
raise AttributeError(
|
359
|
+
f"'{self.__class__.__name__}' object has no attribute '{name}'"
|
360
|
+
)
|
361
|
+
|
330
362
|
|
331
363
|
class CSVFileStore(FileStore):
|
332
364
|
@classmethod
|
edsl/scenarios/handlers/csv.py
CHANGED
@@ -36,3 +36,14 @@ class CsvMethods(FileMethods):
|
|
36
36
|
with tempfile.NamedTemporaryFile(delete=False, suffix=".csv") as f:
|
37
37
|
df.to_csv(f.name, index=False)
|
38
38
|
return f.name
|
39
|
+
|
40
|
+
def to_pandas(self):
|
41
|
+
"""
|
42
|
+
Convert the CSV file to a pandas DataFrame.
|
43
|
+
|
44
|
+
Returns:
|
45
|
+
pandas.DataFrame: The data from the CSV as a DataFrame
|
46
|
+
"""
|
47
|
+
import pandas as pd
|
48
|
+
|
49
|
+
return pd.read_csv(self.path)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: edsl
|
3
|
-
Version: 0.1.39.
|
3
|
+
Version: 0.1.39.dev8
|
4
4
|
Summary: Create and analyze LLM-based surveys
|
5
5
|
Home-page: https://www.expectedparrot.com/
|
6
6
|
License: MIT
|
@@ -107,5 +107,5 @@ See instructions on [storing API keys](https://docs.expectedparrot.com/en/latest
|
|
107
107
|
|
108
108
|
## 💡 Contributions, feature requests & bugs
|
109
109
|
Interested in contributing? Want us to add a new feature? Found a bug for us to squash?
|
110
|
-
Please send us an email at [info@expectedparrot.com](mailto:info@expectedparrot.com) or message us at our [Discord channel](https://discord.com/invite/mxAYkjfy9m)
|
110
|
+
Please send us an email at [info@expectedparrot.com](mailto:info@expectedparrot.com) or message us at our [Discord channel](https://discord.com/invite/mxAYkjfy9m).
|
111
111
|
|
@@ -2,8 +2,8 @@ edsl/Base.py,sha256=-U6ngLZJDqImrAwF-TSmYzMESre0CG5rq9ZFxFh31sY,12864
|
|
2
2
|
edsl/BaseDiff.py,sha256=92BirXj2u3TEGHJWni9TBsvZjvq8wpb4wDL2vxX9Lb0,8253
|
3
3
|
edsl/TemplateLoader.py,sha256=sDBlSMt7EfOduM7w3h6v03gvh_Rzn9hVrlS-iLSQdZA,849
|
4
4
|
edsl/__init__.py,sha256=It2k2drMyde7O-xh0yesod2OxZ3W0yW21zZKRVifv6g,1896
|
5
|
-
edsl/__version__.py,sha256=
|
6
|
-
edsl/agents/Agent.py,sha256=
|
5
|
+
edsl/__version__.py,sha256=ji8YbsVDRyLGjYlX62pFBT72ZltuOjJAVk68nG6AKY8,28
|
6
|
+
edsl/agents/Agent.py,sha256=lF7GD_bCvRLP4hrtm3w451AUfuJln5jZHGYBH84CMVE,40741
|
7
7
|
edsl/agents/AgentList.py,sha256=iRfQfyUYtaJbJ3sRubPqPKRr77nKQgzhFEeZ0wcAEk0,18955
|
8
8
|
edsl/agents/Invigilator.py,sha256=v9KkQ7yQfhwsrZB-7Bu4ZQ-zl_9Hwaxe0uQyxB-Wvss,11862
|
9
9
|
edsl/agents/InvigilatorBase.py,sha256=JIRy7uogI8Hsv8nx8J2zMnd4XK-WQETlSAzkU6uIYNw,8967
|
@@ -261,7 +261,7 @@ edsl/results/tree_explore.py,sha256=hQjiO4E71rIOPDgEHgK8T8ukxqoNdgX_tvyiDlG4_9U,
|
|
261
261
|
edsl/scenarios/ConstructDownloadLink.py,sha256=DGfF6hoCUovpTQ_GWiEndc--fXe9St6UdiaPhj7ZJZw,3529
|
262
262
|
edsl/scenarios/DocumentChunker.py,sha256=LZXh_yx507LMNQ-i2VnSHZiPpRI0XQUECO8e3xAKAjI,3545
|
263
263
|
edsl/scenarios/DocxScenario.py,sha256=ul3nkX826m_T6LFptswqtnH5czP_yxMlLWgbTmFIZI4,482
|
264
|
-
edsl/scenarios/FileStore.py,sha256=
|
264
|
+
edsl/scenarios/FileStore.py,sha256=onFZAqkdqzyQeQ9_2zn1qGY40SqmRG9X8DvtcbXW39o,17418
|
265
265
|
edsl/scenarios/PdfExtractor.py,sha256=ATJ_QOJ3yE7SkdAu3nQdQ-Z9dSjkBZyrEgeuDNtU_ZQ,1310
|
266
266
|
edsl/scenarios/Scenario.py,sha256=670xmH15K0YZovouw4EQc1fdGerY96gtfgfAOOjSxno,17021
|
267
267
|
edsl/scenarios/ScenarioHtmlMixin.py,sha256=5H8MnPPWqlGZ0_Ojv1WjkFaNNRrr-JpCRwlABDBfPXs,2111
|
@@ -272,7 +272,7 @@ edsl/scenarios/__init__.py,sha256=CQXwTNTIG9jg_pLkDPZgapUFY0_LwZFVQ8HaYvof0Nc,14
|
|
272
272
|
edsl/scenarios/directory_scanner.py,sha256=eJHPx6pc_No-I-old0vwrNRwNxmgnn3Fr6mht5mp8Fw,3312
|
273
273
|
edsl/scenarios/file_methods.py,sha256=HeusyoXOi2Bb0Bfp8MVDWKMFpe_ipP-cxENiRrSKZQU,2621
|
274
274
|
edsl/scenarios/handlers/__init__.py,sha256=4GdEfrAk5a7mUfbwnf0TCcrvp1_aAYZPAnd433NmiGM,384
|
275
|
-
edsl/scenarios/handlers/csv.py,sha256=
|
275
|
+
edsl/scenarios/handlers/csv.py,sha256=5W2fWa6FAL_QGTYTVLFaiEr28f6W7FaF-a9drsklSfc,1383
|
276
276
|
edsl/scenarios/handlers/docx.py,sha256=e6POWp3Xs-XCVr8TKMtDka1ZRySXZf17TcSimvw6owY,2203
|
277
277
|
edsl/scenarios/handlers/html.py,sha256=zXipNAYcQE4LRBrKZC9L_tkY1snxQe8ciJ2S1diyMcM,927
|
278
278
|
edsl/scenarios/handlers/json.py,sha256=hlZMHYwwuFrV9bGdbn8MNAjgBFue6l5W2TwCfyxSjZ0,3682
|
@@ -352,7 +352,7 @@ edsl/utilities/remove_edsl_version.py,sha256=3n2RoXvZ4pH3k-_lc7B-vkeUyHXHX6vKHQS
|
|
352
352
|
edsl/utilities/repair_functions.py,sha256=tftmklAqam6LOQQu_-9U44N-llycffhW8LfO63vBmNw,929
|
353
353
|
edsl/utilities/restricted_python.py,sha256=5-_zUhrNbos7pLhDl9nr8d24auRlquR6w-vKkmNjPiA,2060
|
354
354
|
edsl/utilities/utilities.py,sha256=FbI9QYGD4eaHrwZ6ePx51jjpatZqwSPHJhimx-h6HyA,12660
|
355
|
-
edsl-0.1.39.
|
356
|
-
edsl-0.1.39.
|
357
|
-
edsl-0.1.39.
|
358
|
-
edsl-0.1.39.
|
355
|
+
edsl-0.1.39.dev8.dist-info/LICENSE,sha256=_qszBDs8KHShVYcYzdMz3HNMtH-fKN_p5zjoVAVumFc,1111
|
356
|
+
edsl-0.1.39.dev8.dist-info/METADATA,sha256=5Lo6OdFHPgddYIAEXmSmPB9zS8ChSgkhqaPuMstpGFE,4765
|
357
|
+
edsl-0.1.39.dev8.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
358
|
+
edsl-0.1.39.dev8.dist-info/RECORD,,
|
File without changes
|
File without changes
|