Mar-12-2020, 06:10 PM
(This post was last modified: Mar-12-2020, 06:10 PM by sambanerjee.)
Hi:
I'm working on a project (I'm new to Python) and am stuck at a method - any help will be greatly appreciated.
This is the portion that is error-ing out
the
here is the pip list
Package Version
------------------ ------------
-cipy 1.4.1
-umpy 1.18.1
astroid 2.1.0
attrs 19.3.0
backcall 0.1.0
bleach 3.1.0
certifi 2019.6.16
chardet 3.0.4
chart-studio 1.0.0
colorama 0.4.1
colour 0.1.5
cvxpy 1.0.3
cycler 0.10.0
data 0.4
DateTime 4.3
dbfpy 2.3.1
decorator 4.4.1
defusedxml 0.6.0
dill 0.3.1.1
ecos 2.0.7.post1
entrypoints 0.3
eyeD3 0.8.9
fastcache 1.1.0
funcsigs 1.0.2
future 0.18.2
idna 2.6
importlib-metadata 1.4.0
ipykernel 5.1.3
ipython 7.11.1
ipython-genutils 0.2.0
ipywidgets 7.5.1
isort 4.3.4
jedi 0.15.2
Jinja2 2.10.3
joblib 0.14.1
json5 0.9.2
jsonschema 3.2.0
jupyter 1.0.0
jupyter-client 5.3.4
jupyter-console 6.1.0
jupyter-core 4.6.1
jupyterlab 2.0.1
jupyterlab-server 1.0.7
kiwisolver 1.1.0
lazy-object-proxy 1.3.1
lxml 4.4.2
MarkupSafe 1.1.1
mathjax 0.1.2
matplotlib 3.1.3
mccabe 0.6.1
mistune 0.8.4
more-itertools 8.1.0
multiprocess 0.70.9
nbconvert 5.6.1
nbformat 5.0.3
notebook 6.0.2
numpy 1.18.1
osqp 0.6.1
pandas 0.25.3
pandas-datareader 0.8.1
pandocfilters 1.4.2
parso 0.5.2
patsy 0.5.1
pickleshare 0.7.5
pip 20.0.2
plotly 4.5.4
prometheus-client 0.7.1
prompt-toolkit 3.0.2
Pygments 2.5.2
pylint 2.2.2
pyparsing 2.2.0
pyrsistent 0.15.7
python-dateutil 2.6.1
python-magic 0.4.15
pytz 2017.3
pywin32 227
pywinpty 0.5.7
pyzmq 18.1.1
qtconsole 4.6.0
requests 2.18.4
retrying 1.3.3
scikit-learn 0.22.2.post1
scipy 1.4.1
scs 2.1.1.post2
Send2Trash 1.5.0
setuptools 46.0.0
six 1.12.0
statsmodels 0.11.1
terminado 0.8.3
testpath 0.4.4
toolz 0.10.0
tornado 6.0.3
tqdm 4.43.0
traitlets 4.3.3
urllib3 1.22
wcwidth 0.1.8
webencodings 0.5.1
widgetsnbextension 3.5.1
wrapt 1.10.11
xlrd 1.2.0
zipp 1.0.0
zope.interface 4.7.1
I'm working on a project (I'm new to Python) and am stuck at a method - any help will be greatly appreciated.
This is the portion that is error-ing out
monthly_close = resample_prices(close) project_helper.plot_resampled_prices( monthly_close.loc[:, apple_ticker], close.loc[:, apple_ticker], '{} Stock - Close Vs Monthly Close'.format(apple_ticker))
Error:---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in
3 monthly_close.loc[:, apple_ticker],
4 close.loc[:, apple_ticker],
----> 5 '{} Stock - Close Vs Monthly Close'.format(apple_ticker))
f:\hidden\project_helper.py in plot_resampled_prices(df_resampled, df, title)
68 traces = _generate_traces([
69 ('Monthly Close', df_resampled, helper.color_scheme['major_line']),
---> 70 ('Close', df, helper.color_scheme['minor_line'])])
71 offline_py.iplot({'data': traces, 'layout': layout}, config=config)
72
f:\hidden\project_helper.py in _generate_traces(name_df_color_data)
22 y=df,
23 mode='line',
---> 24 line={'color': color}))
25 return traces
26
f:\hidden\Python\lib\site-packages\plotly\graph_objs\__init__.py in __init__(self, arg, cliponaxis, connectgaps, customdata, customdatasrc, dx, dy, error_x, error_y, fill, fillcolor, groupnorm, hoverinfo, hoverinfosrc, hoverlabel, hoveron, hovertemplate, hovertemplatesrc, hovertext, hovertextsrc, ids, idssrc, legendgroup, line, marker, meta, metasrc, mode, name, opacity, orientation, r, rsrc, selected, selectedpoints, showlegend, stackgaps, stackgroup, stream, t, text, textfont, textposition, textpositionsrc, textsrc, texttemplate, texttemplatesrc, tsrc, uid, uirevision, unselected, visible, x, x0, xaxis, xcalendar, xsrc, y, y0, yaxis, ycalendar, ysrc, **kwargs)
38026 self["metasrc"] = metasrc if metasrc is not None else _v
38027 _v = arg.pop("mode", None)
> 38028 self["mode"] = mode if mode is not None else _v
38029 _v = arg.pop("name", None)
38030 self["name"] = name if name is not None else _v
f:\hidden\Python\lib\site-packages\plotly\basedatatypes.py in __setitem__(self, prop, value)
3488 # ### Handle simple property ###
3489 else:
-> 3490 self._set_prop(prop, value)
3491
3492 # Handle non-scalar case
f:\hidden\Python\lib\site-packages\plotly\basedatatypes.py in _set_prop(self, prop, val)
3775 return
3776 else:
-> 3777 raise err
3778
3779 # val is None
f:\hidden\Python\lib\site-packages\plotly\basedatatypes.py in _set_prop(self, prop, val)
3770 validator = self._validators.get(prop)
3771 try:
-> 3772 val = validator.validate_coerce(val)
3773 except ValueError as err:
3774 if self._skip_invalid:
f:\hidden\Python\lib\site-packages\_plotly_utils\basevalidators.py in validate_coerce(self, v)
1865 validated_v = self.vc_scalar(v)
1866 if validated_v is None:
-> 1867 self.raise_invalid_val(v)
1868
1869 v = validated_v
f:\hidden\Python\lib\site-packages\_plotly_utils\basevalidators.py in raise_invalid_val(self, v, inds)
281 typ=type_str(v),
282 v=repr(v),
--> 283 valid_clr_desc=self.description(),
284 )
285 )
ValueError:
Invalid value of type 'builtins.str' received for the 'mode' property of scatter
Received value: 'line'
The 'mode' property is a flaglist and may be specified
as a string containing:
- Any combination of ['lines', 'markers', 'text'] joined with '+' characters
(e.g. 'lines+markers')
OR exactly one of ['none'] (e.g. 'none')
The entire project can be seen here -- https://github.com/mehta-a/AI-For-Tradin...0(1).ipynbthe
def _generate_traces(name_df_color_data): traces = [] for name, df, color in name_df_color_data: traces.append(go.Scatter( name=name, x=df.index, y=df, mode='line', line={'color': color})) return tracesI'm using Visual Studio Code with Jupyter notebook
here is the pip list
Package Version
------------------ ------------
-cipy 1.4.1
-umpy 1.18.1
astroid 2.1.0
attrs 19.3.0
backcall 0.1.0
bleach 3.1.0
certifi 2019.6.16
chardet 3.0.4
chart-studio 1.0.0
colorama 0.4.1
colour 0.1.5
cvxpy 1.0.3
cycler 0.10.0
data 0.4
DateTime 4.3
dbfpy 2.3.1
decorator 4.4.1
defusedxml 0.6.0
dill 0.3.1.1
ecos 2.0.7.post1
entrypoints 0.3
eyeD3 0.8.9
fastcache 1.1.0
funcsigs 1.0.2
future 0.18.2
idna 2.6
importlib-metadata 1.4.0
ipykernel 5.1.3
ipython 7.11.1
ipython-genutils 0.2.0
ipywidgets 7.5.1
isort 4.3.4
jedi 0.15.2
Jinja2 2.10.3
joblib 0.14.1
json5 0.9.2
jsonschema 3.2.0
jupyter 1.0.0
jupyter-client 5.3.4
jupyter-console 6.1.0
jupyter-core 4.6.1
jupyterlab 2.0.1
jupyterlab-server 1.0.7
kiwisolver 1.1.0
lazy-object-proxy 1.3.1
lxml 4.4.2
MarkupSafe 1.1.1
mathjax 0.1.2
matplotlib 3.1.3
mccabe 0.6.1
mistune 0.8.4
more-itertools 8.1.0
multiprocess 0.70.9
nbconvert 5.6.1
nbformat 5.0.3
notebook 6.0.2
numpy 1.18.1
osqp 0.6.1
pandas 0.25.3
pandas-datareader 0.8.1
pandocfilters 1.4.2
parso 0.5.2
patsy 0.5.1
pickleshare 0.7.5
pip 20.0.2
plotly 4.5.4
prometheus-client 0.7.1
prompt-toolkit 3.0.2
Pygments 2.5.2
pylint 2.2.2
pyparsing 2.2.0
pyrsistent 0.15.7
python-dateutil 2.6.1
python-magic 0.4.15
pytz 2017.3
pywin32 227
pywinpty 0.5.7
pyzmq 18.1.1
qtconsole 4.6.0
requests 2.18.4
retrying 1.3.3
scikit-learn 0.22.2.post1
scipy 1.4.1
scs 2.1.1.post2
Send2Trash 1.5.0
setuptools 46.0.0
six 1.12.0
statsmodels 0.11.1
terminado 0.8.3
testpath 0.4.4
toolz 0.10.0
tornado 6.0.3
tqdm 4.43.0
traitlets 4.3.3
urllib3 1.22
wcwidth 0.1.8
webencodings 0.5.1
widgetsnbextension 3.5.1
wrapt 1.10.11
xlrd 1.2.0
zipp 1.0.0
zope.interface 4.7.1