Unexpected error when plotting data points
- Dominant language
- Python
- Stars
- 93.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Trying to plot some data points using sublime text and I get this error. Any help would be appreciated.
Command ran:
```
from manimlib.imports import *
#Function to return data from .csv file to an array
def get_coords_from_csv(coronavirus_data):
import csv
coords = []
with open(f'coronavirus_data.csv', 'r') as csvFile:
reader = csv.reader(csvFile)
for row in reader:
x,y = row
coord = [float(x),float(y)]
coords.append(coord)
csvFile.close()
return coords
class GraphFromData(GraphScene):
def get_points_from_coords(self,coords):
return[
self.coords_to_point(px,py)
for px,py in coords
]
def get_dots_from_coords(self, coords, radius=0.1):
points = self.get_points_from_coords(coords)
dots = VGroup(*[
Dot(radius=radius).move_to([px,py,pz])
for px,py,pz in points
]
)
return dots
class DiscreteGraphFromSetPoints(VMobject):
def __init__(self, set_of_points, **kwargs):
super().__init__(**kwargs)
self.set_points_as_corners(set_of_points)
class SmoothGraphFromSetPoints(VMobject):
def __init__(self, set_of_points, **kwargs):
super().__init__(**kwargs)
self.set_points_smoothly(set_of_points)
#Graph with set of points
class CustomGraph1(GraphFromData):
def construct(self):
self.setup_axes()
coords = get_coords_from_csv("coronavirus_data")
dots = self.get_dots_from_coords(coords)
self.add(dots)
```
The error:
Traceback (most recent call last):
File "/Users/lewis/Documents/animation/manim/manimlib/extract_scene.py", line 155, in main
scene = SceneClass(**scene_kwargs)
File "/Users/lewis/Documents/animation/manim/manimlib/scene/scene.py", line 53, in __init__
self.construct()
File "coronavirus.py", line 49, in construct
coords = get_coords_from_csv("coronavirus_data")
File "coronavirus.py", line 13, in get_coords_from_csv
coord = [float(x),float(y)]
ValueError: could not convert string to float: '\ufeff1'
Many thanks :)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.