0

I have different columns of data in a file and this commands works for some columns but gives these errors for the rest of them, can anybody help me understand what the problem is please?

Data4 = df4['lab 4']

plt.plot(Data4 , label = "line")

Data4.describe()

    ---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-55-df75dc88ca04> in <module>()
      1 col4 = df4['col 4']
      2 
----> 3 plt.plot(col4, label = "line")
      4 
      5 col4.describe()

6 frames
/usr/local/lib/python3.7/dist-packages/matplotlib/pyplot.py in plot(scalex, scaley, data, *args, **kwargs)
   2761     return gca().plot(
   2762         *args, scalex=scalex, scaley=scaley, **({"data": data} if data
-> 2763         is not None else {}), **kwargs)
   2764 
   2765 

/usr/local/lib/python3.7/dist-packages/matplotlib/axes/_axes.py in plot(self, scalex, scaley, data, *args, **kwargs)
   1647         lines = [*self._get_lines(*args, data=data, **kwargs)]
   1648         for line in lines:
-> 1649             self.add_line(line)
   1650         self._request_autoscale_view(scalex=scalex, scaley=scaley)
   1651         return lines

/usr/local/lib/python3.7/dist-packages/matplotlib/axes/_base.py in add_line(self, line)
   1848             line.set_clip_path(self.patch)
   1849 
-> 1850         self._update_line_limits(line)
   1851         if not line.get_label():
   1852             line.set_label('_line%d' % len(self.lines))

/usr/local/lib/python3.7/dist-packages/matplotlib/axes/_base.py in _update_line_limits(self, line)
   1870         Figures out the data limit of the given line, updating self.dataLim.
   1871         """
-> 1872         path = line.get_path()
   1873         if path.vertices.size == 0:
   1874             return

/usr/local/lib/python3.7/dist-packages/matplotlib/lines.py in get_path(self)
   1025         """
   1026         if self._invalidy or self._invalidx:
-> 1027             self.recache()
   1028         return self._path
   1029 

/usr/local/lib/python3.7/dist-packages/matplotlib/lines.py in recache(self, always)
    673         if always or self._invalidy:
    674             yconv = self.convert_yunits(self._yorig)
--> 675             y = _to_unmasked_float_array(yconv).ravel()
    676         else:
    677             y = self._y

/usr/local/lib/python3.7/dist-packages/matplotlib/cbook/__init__.py in _to_unmasked_float_array(x)
   1315         return np.ma.asarray(x, float).filled(np.nan)
   1316     else:
-> 1317         return np.asarray(x, float)
   1318 
   1319 

ValueError: could not convert string to float: '#VALUE!'
2
  • 3
    There is a value error in your excel file so when you read your data using pandas your get the string #VALUE! which cannot be converted to a float - i.e., float('#VALUE!') Commented May 16, 2022 at 18:10
  • This link may be helpful for you link. Sometimes, It may be super easy to work with 'Plotly' when using pandas data frames. Commented May 16, 2022 at 18:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.