You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem
Creating a Series object using the from_pandas method raises a HighchartsValueError if the column is of type datetime. The problem started appearing after upgrading highcharts_core to v1.4.0.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/highcharts_core/options/series/data/collections.py", line 274, in __setattr__
setattr(data_points[index], name, value[index])
File "/usr/local/lib/python3.10/site-packages/highcharts_core/options/series/data/cartesian.py", line 134, in x
value = validators.string(value)
File "/usr/local/lib/python3.10/site-packages/validator_collection/_decorators.py", line 51, in func_wrapper
return func(*args, **updated_kwargs)
File "/usr/local/lib/python3.10/site-packages/validator_collection/validators.py", line 241, in string
raise errors.CannotCoerceError('value (%s) was not coerced to a string' % value)
validator_collection.errors.CannotCoerceError: value (2023-10-01T00:00:00.000000000) was not coerced to a string
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.10/site-packages/highcharts_core/options/series/base.py", line 2108, in from_pandas
series_list = cls._from_pandas_multi_map(df,
File "/usr/local/lib/python3.10/site-packages/highcharts_core/options/series/base.py", line 1859, in _from_pandas_multi_map
setattr(collection_instance, key, prop_array)
File "/usr/local/lib/python3.10/site-packages/highcharts_core/options/series/data/collections.py", line 285, in __setattr__
raise errors.HighchartsValueError(
highcharts_core.errors.HighchartsValueError: Unable to set x to 2023-10-01T00:00:00.000000000. If using a helper method, this is likely due to mismatched columns. Please review your input data.
To Repoduce run the following code
importpandasaspdimportdatetimeasdtfromhighcharts_core.options.series.areaimportLineSeries# Generate timestamps for the first 5 days of October 2023start_date=dt.datetime(2023, 10, 1)
end_date=dt.datetime(2023, 10, 5)
date_range= [start_date+dt.timedelta(days=i) foriinrange(5)]
# Create a list of valuesvalues= [10, 20, 30, 40, 50]
# Create a DataFramedf=pd.DataFrame({'Timestamp': date_range, 'Value': values})
LineSeries.from_pandas(df, property_map={"x": "Timestamp", "y": "Value"})
Environment:
OS: Linux
Python Version: 3.10.8
Highcharts Python Version: 1.4.0
The text was updated successfully, but these errors were encountered:
@abbas-mohd56 : FYI - this issue should have been fixed in the new version (v.1.4.1) that was just released. Thanks for letting us know about the problem!
Problem
Creating a Series object using the
from_pandas
method raises aHighchartsValueError
if the column is of typedatetime
. The problem started appearing after upgradinghighcharts_core
tov1.4.0
.Imagine a DataFrame
df
with the following data:When creating a
LineSeries
object as shownThe following error is raised
To Repoduce run the following code
Environment:
The text was updated successfully, but these errors were encountered: