Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Tutorial básico Julia Python

497 views
ubuntu2004
Kernel: SageMath 9.4
import pandas as pd saida = pd.read_csv('saida.csv',index_col = 0)
saida
saida['x'] = range(0, 1196527);
saida
len(saida.x) == len(saida.Sensor1)
True
saida.loc[[2:]]
File "<ipython-input-28-fae6514ef85d>", line 1 saida.loc[[Integer(2):]] ^ SyntaxError: invalid syntax
scatter_plot([[saida.x[, saida.Sensor1]])
Image in a Jupyter notebook
import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation x = [] y = [] figure, ax = plt.subplots(figsize=(4,3)) line, = ax.plot(x, y) plt.axis([0, 4*np.pi, -1, 1]) def func_animate(i): x = np.linspace(0, 4*np.pi, 1000) y = np.sin(2 * (x - 0.1 * i)) line.set_data(x, y) return line, ani = FuncAnimation(figure, func_animate, frames=10, interval=50) ani.save(r'animation.gif', fps=10) plt.show()
Image in a Jupyter notebook
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation def animate(frameno): x = mu + sigma * np.random.randn(10000) n, _ = np.histogram(x, bins, normed=True) for rect, h in Zip(patches, n): rect.set_height(h) return patches mu, sigma = 100, 15 fig, ax = plt.subplots() x = mu + sigma * np.random.randn(10000) n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75) ani = animation.FuncAnimation(fig, animate, blit=True, interval=10, repeat=True) plt.show()
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-30-05cb1be5acfb> in <module> 14 fig, ax = plt.subplots() 15 x = mu + sigma * np.random.randn(Integer(10000)) ---> 16 n, bins, patches = plt.hist(x, Integer(50), normed=Integer(1), facecolor='green', alpha=RealNumber('0.75')) 17 18 ani = animation.FuncAnimation(fig, animate, blit=True, interval=Integer(10), /ext/sage/9.4/local/lib/python3.9/site-packages/matplotlib/pyplot.py in hist(x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, data, **kwargs) 2683 orientation='vertical', rwidth=None, log=False, color=None, 2684 label=None, stacked=False, *, data=None, **kwargs): -> 2685 return gca().hist( 2686 x, bins=bins, range=range, density=density, weights=weights, 2687 cumulative=cumulative, bottom=bottom, histtype=histtype, /ext/sage/9.4/local/lib/python3.9/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs) 1445 def inner(ax, *args, data=None, **kwargs): 1446 if data is None: -> 1447 return func(ax, *map(sanitize_sequence, args), **kwargs) 1448 1449 bound = new_sig.bind(ax, *args, **kwargs) /ext/sage/9.4/local/lib/python3.9/site-packages/matplotlib/axes/_axes.py in hist(self, x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs) 6813 if patch: 6814 p = patch[0] -> 6815 p.update(kwargs) 6816 if lbl is not None: 6817 p.set_label(lbl) /ext/sage/9.4/local/lib/python3.9/site-packages/matplotlib/artist.py in update(self, props) 994 func = getattr(self, f"set_{k}", None) 995 if not callable(func): --> 996 raise AttributeError(f"{type(self).__name__!r} object " 997 f"has no property {k!r}") 998 ret.append(func(v)) AttributeError: 'Rectangle' object has no property 'normed'
Image in a Jupyter notebook
import numpy as np import matplotlib.pyplot as plt plt.ion() mu, sigma = 100, 15 fig = plt.figure() x = mu + sigma*np.random.randn(10000) n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75) for i in range(50): x = mu + sigma*np.random.randn(10000) n, bins = np.histogram(x, bins, normed=True) for rect,h in Zip(patches,n): rect.set_height(h) fig.canvas.draw()
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-31-5cefc7834dc4> in <module> 6 fig = plt.figure() 7 x = mu + sigma*np.random.randn(Integer(10000)) ----> 8 n, bins, patches = plt.hist(x, Integer(50), normed=Integer(1), facecolor='green', alpha=RealNumber('0.75')) 9 for i in range(Integer(50)): 10 x = mu + sigma*np.random.randn(Integer(10000)) /ext/sage/9.4/local/lib/python3.9/site-packages/matplotlib/pyplot.py in hist(x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, data, **kwargs) 2683 orientation='vertical', rwidth=None, log=False, color=None, 2684 label=None, stacked=False, *, data=None, **kwargs): -> 2685 return gca().hist( 2686 x, bins=bins, range=range, density=density, weights=weights, 2687 cumulative=cumulative, bottom=bottom, histtype=histtype, /ext/sage/9.4/local/lib/python3.9/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs) 1445 def inner(ax, *args, data=None, **kwargs): 1446 if data is None: -> 1447 return func(ax, *map(sanitize_sequence, args), **kwargs) 1448 1449 bound = new_sig.bind(ax, *args, **kwargs) /ext/sage/9.4/local/lib/python3.9/site-packages/matplotlib/axes/_axes.py in hist(self, x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs) 6813 if patch: 6814 p = patch[0] -> 6815 p.update(kwargs) 6816 if lbl is not None: 6817 p.set_label(lbl) /ext/sage/9.4/local/lib/python3.9/site-packages/matplotlib/artist.py in update(self, props) 994 func = getattr(self, f"set_{k}", None) 995 if not callable(func): --> 996 raise AttributeError(f"{type(self).__name__!r} object " 997 f"has no property {k!r}") 998 ret.append(func(v)) AttributeError: 'Rectangle' object has no property 'normed'
Image in a Jupyter notebook