Comments (1)
problem1: reads data with an imaginary comma
problem 2: not sure if this is a hallucination issue. it thinks it thinks it saved a file but it doesnt and then has a hard time finding to render.
problem 3: does a bizarre unstack at times which DOES NOT work and then a df pivot which WORKS.
problem1
data = dfs[0]
data['totalWeeklyShareQuantity'] = data['totalWeeklyShareQuantity'].str.replace(',', '').astype(int)
grouped_data = data.groupby(['MPID', 'securitytype'])['totalWeeklyShareQuantity'].sum().unstack()
plt.figure(figsize=(12, 6))
grouped_data.plot(kind='bar')
plt.ylabel('totalWeeklyShareQuantity')
plt.title('Total Weekly Share Quantity by MPID and Security Type')
plt.show()
```
2024-04-17 12:51:42 [ERROR] Failed with error: Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/pandasai/pipelines/chat/code_execution.py", line 85, in execute
result = self.execute_code(input, code_context)
File "/usr/local/lib/python3.9/site-packages/pandasai/pipelines/chat/code_execution.py", line 170, in execute_code
exec(code, environment)
File "", line 2, in
File "/usr/local/lib64/python3.9/site-packages/pandas/core/generic.py", line 6240, in astype
new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
File "/usr/local/lib64/python3.9/site-packages/pandas/core/internals/managers.py", line 448, in astype
return self.apply("astype", dtype=dtype, copy=copy, errors=errors)
File "/usr/local/lib64/python3.9/site-packages/pandas/core/internals/managers.py", line 352, in apply
applied = getattr(b, f)(**kwargs)
File "/usr/local/lib64/python3.9/site-packages/pandas/core/internals/blocks.py", line 526, in astype
new_values = astype_array_safe(values, dtype, copy=copy, errors=errors)
File "/usr/local/lib64/python3.9/site-packages/pandas/core/dtypes/astype.py", line 299, in astype_array_safe
new_values = astype_array(values, dtype, copy=copy)
File "/usr/local/lib64/python3.9/site-packages/pandas/core/dtypes/astype.py", line 230, in astype_array
values = astype_nansafe(values, dtype, copy=copy)
File "/usr/local/lib64/python3.9/site-packages/pandas/core/dtypes/astype.py", line 170, in astype_nansafe
return arr.astype(dtype, copy=True)
ValueError: invalid literal for int() with base 10: '38,000'
in my my input file - i dont have commas. so not sure what its trying to do here.
totalWeeklyShareQuantity,totalWeeklyTradeCount,issueSymbolIdentifier,issueName,MPID,tierIdentifier,Tick
er,Industry,Sector,securitytype,50-day Moving Average,bin_50-day Moving Average
38000,169,SPTI,SPDR Portfolio Intermediate Term Treasury ETF,INCR,T1,SPTI,,,ETF,28.190799980163575,10-5
0
problem 2
2024-04-17 18:27:04 [INFO] Executing Step 4: CachePopulation
2024-04-17 18:27:04 [INFO] Executing Step 5: CodeCleaning
2024-04-17 18:27:04 [INFO] Saving charts to /usr/local/first/static/ff56c1e8-d272-4298-b3fc-2c732b296144.png
2024-04-17 18:27:04 [INFO]
Code running:
data = dfs[0].groupby(['MPID', 'securitytype'])['totalWeeklyShareQuantity'].sum().unstack()
data.plot(kind='bar', figsize=(12, 6), width=0.8)
plt.xlabel('MPID')
plt.ylabel('Total Weekly Share Quantity')
plt.title('Total Weekly Share Quantity by MPID and Security Type')
plt.legend(title='Security Type')
plt.show()
result = {'type': 'plot', 'value': '/usr/local/first/static/ff56c1e8-d272-4298-b3fc-2c732b296144.png'}
```
2024-04-17 18:27:04 [INFO] Executing Step 6: CodeExecution
2024-04-17 18:27:04 [ERROR] Pipeline failed on step 6: [Errno 2] No such file or directory: '/usr/local/first/static/ff56c1e8-d272-4298-b3fc-2c732b296144.png'
2024-04-17 18:27:05 [INFO] 100.8.116.94 - - [17/Apr/2024 18:27:05] "POST /chat HTTP/1.1" 200 -
2024-04-17 18:27:05 [INFO] 100.8.116.94 - - [17/Apr/2024 18:27:05] "^[[33mGET /Unfortunately,%20I%20was%20not%20able%20to%20answer%20your%20question,%20because%20of%20the%20following%20error:[Errno%202]%20No%20such%20file%20or%20directory:%20'/usr/local/first/static/ff56c1e8-d272-4298-b3fc-2c732b296144.png' HTTP/1.1^[[0m" 404 -
2024-04-17 18:27:07 [INFO] 100.8.116.94 - - [17/Apr/2024 18:27:07] "GET / HTTP/1.1" 200 -
2024-04-17 18:27:08 [INFO] 100.8.116.94 - - [17/Apr/2024 18:27:08] "^[[36mGET /static/shanklogo HTTP/1.1^[[0m" 304 -
:$
**PROBLEM 3**
# Prepare the data for plotting
data = dfs[0].groupby(['MPID', 'securitytype'])['totalWeeklyShareQuantity'].sum().unstack()
# Plot the data side by side
data.plot(kind='bar', figsize=(12, 6), width=0.8)
plt.xlabel('MPID')
plt.ylabel('Total Weekly Share Quantity')
plt.title('Total Weekly Share Quantity by MPID and Security Type')
plt.legend(title='Security Type')
plt.show()
# Declare result variable
result = {"type": "plot", "value": "temp_chart.png"}
```
2024-04-17 18:27:04 [INFO] Executing Step 4: CachePopulation
2024-04-17 18:27:04 [INFO] Executing Step 5: CodeCleaning
2024-04-17 18:27:04 [INFO] Saving charts to /usr/local/first/static/ff56c1e8-d272-4298-b3fc-2c732b296144.png
2024-04-17 18:27:04 [INFO]
Code running:
data = dfs[0].groupby(['MPID', 'securitytype'])['totalWeeklyShareQuantity'].sum().unstack()
data.plot(kind='bar', figsize=(12, 6), width=0.8)
plt.xlabel('MPID')
plt.ylabel('Total Weekly Share Quantity')
plt.title('Total Weekly Share Quantity by MPID and Security Type')
plt.legend(title='Security Type')
plt.show()
result = {'type': 'plot', 'value': '/usr/local/first/static/ff56c1e8-d272-4298-b3fc-2c732b296144.png'}
```
2024-04-17 18:27:04 [INFO] Executing Step 6: CodeExecution
2024-04-17 18:27:04 [ERROR] Pipeline failed on step 6: [Errno 2] No such file or directory: '/usr/local/first/static/ff56c1e8-d272-4298-b3fc-2c732b296144.png'
2024-04-17 18:27:05 [INFO] 100.8.116.94 - - [17/Apr/2024 18:27:05] "POST /chat HTTP/1.1" 200 -
2024-04-17 18:27:05 [INFO] 100.8.116.94 - - [17/Apr/2024 18:27:05] "^[[33mGET /Unfortunately,%20I%20was%20not%20able%20to%20answer%20your%20question,%20because%20of%20the%20following%20error:[Errno%202]%20No%20such%20file%20or%20directory:%20'/usr/local/first/static/ff56c1e8-d272-4298-b3fc-2c732b296144.png' HTTP/1.1^[[0m" 404 -
from pandas-ai.
Related Issues (20)
- Provide custom chart name to save in charts_directory while chatting with the PandasAI
- The graph getting generated in Jupyter is fine, but the image getting saved as a .png file is getting distorted where portions of the image from the left & right are not present and a distorted image is getting saved HOT 1
- JSON error on any prompt passed. Expecting value: line 1 column 1 (char 0). Set up using Ollama (llama3) on local with LangChain.
- enforce_privacy dose not work? HOT 1
- Clarification question and explain to support replying in the same language as query.
- Custom head not working HOT 1
- Gradio support
- Column MultiIndex support
- Simple query on Python/Streamlit raises pandasai.exceptions.PandasAIApiCallError HOT 3
- Add Firebase database as connector
- The figure is still saved in default folder when I set "save_charts" as False
- get_openai_callback bug when model is gpt-4o HOT 2
- Agent not working as expected HOT 1
- LocalLLM Error 400 - chat messages must alternate roles between 'user' and 'assistant' HOT 6
- (cx_Oracle.DatabaseError) ORA-00904: "RAND": invalid identifier
- NameError: name 'pl' is not defined HOT 2
- it cannot answer to the questions once 3 data frames are merged and provided HOT 1
- How do i get an api key HOT 1
- "verbose": False seems to still log to console HOT 1
- Support Chinese characters in prompt generation stage HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandas-ai.