I have just installed the new Mint 22.2 as my old hard disk with Mint 21 seems to have some issues. I use Eric-IDE to execute my .py script.
The script is first downloading stock values from a certain date, and after that it is supposed to draw curves in the time area defined with startplot and endplot.
On my old installation it has worked without any issues, but now after using the exact same script I get this error message when reading the Plotdata. The file with Plotdate looks ok.
The lines having the issue are those:
Plotdata.to_csv(plotfil, columns=['Date', 'Close', 'High', 'Low', 'Open', 'Volume'], index=0)
print('Here I am 1')
try:
date, closep, highp, lowp, openp, volume = np.loadtxt(plotfil,delimiter=',',skiprows=1, unpack=True, converters={ 0: bytespdate2num('%Y-%m-%d')})
print('Here I am 2')
The message 'Here I am 1' is printed but 'Here I am 2' is not so I expect the converter bytespdate2num is failing, but that converter is working on the old installation.
The converter is this:
def bytespdate2num(fmt, encoding='utf-8'):
def bytesconverter(b):
s = b.decode(encoding)
return (mdates.datestr2num(s))
return bytesconverter
I am importing the following in the script:
import pandas as pd
import datetime
import csv
import pylab
import os
import glob
import time
import re
import yfinance as yf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib.dates as mdates
from matplotlib.widgets import CheckButtons
import matplotlib
In the new Mint 22.2 it seems that matplotlib 3.6.3 is installed where I had 3.7.1 in the old Mint 21.2. I have tried to remove and reinstall matplotlib but always version 3.6.3 is downloaded.
The only output I get is this: No other errors
Here I am 1
main loop could not convert string '2023-01-02' to float64 at row 0, column 1.
The plotfile looks like this:
Date,Close,High,Low,Open,Volume
2023-01-03,108.0999984741211,118.8000030517578,104.63999938964844,118.47000122070312,231402800
2023-01-04,113.63999938964844,114.58999633789062,107.5199966430664,109.11000061035156,180389000
2023-01-05,110.33999633789062,111.75,107.16000366210938,110.51000213623048,157986300
I have installed Eric-Ide in the virtual eric_env on both installations.
The Python version is 3.12.3
~/eric_env/bin/python3 -m pip install numpy
~/eric_env/bin/python3 -m pip install yfinance --upgrade --no-cache-dir
~/eric_env/bin/python3 -m pip install -U matplotlib
sudo apt-get install python3-matplotlib #no changes
~/eric_env/bin/python3 -m pip install pandas
My question is what can be the reason for the converter to fail now.
What am I missing here?.
piporapt? What version of Python do you use - default (for Mint 22) 3.12 or other?minimal working codewhich shows this problem - only withmatplotlibandpandas(with data hardcoded aspd.DataFrame(...)) - so we could simply copy and test it on other systems. I can test it on Mint 22.1 with Python 3.9, 3.10, 3.11, 3.12, 3.13, 3.14 (at this moment withmatplotlib3.10.0but withvenvI can test with3.6.3and3.7.1)yfinancethen columnDateshould keep values asdatetimeobject and then you could even trydf["float_date"] = df["Date"].astype("int64") / 1e9 / 86400without usingmatplotlib.dates