Created
June 16, 2022 02:27
-
-
Save git-jr/881d042e5cd2d77d7633166ae5957296 to your computer and use it in GitHub Desktop.
Exemplos de código para começar em Ciência de Dados pelo Celular. Uso no vídeo: https://youtu.be/29WQ8c3P9mw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from matplotlib import pyplot as plt | |
ys = 200 + np.random.randn(100) | |
x = [x for x in range(len(ys))] | |
plt.plot(x, ys, '-') | |
plt.fill_between(x, ys, 195, where=(ys > 195), facecolor='g', alpha=0.6) | |
plt.title("Exempo de Gráfico") | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plot | |
data = np.random.randn(420, 4); | |
dataFrame = pd.DataFrame(data=data, columns=['Coluna A', 'Coluna B', 'Coluna C', 'Coluna D']); | |
dataFrame.plot.scatter(x='Coluna A', y='Coluna D', title= "O Famoso Gráfico de Dispersão"); | |
plot.show(block=True); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from wordcloud import WordCloud, STOPWORDS | |
import numpy as np | |
text = open(r'LetraMusica.txt', mode='r', encoding='utf-8').read() | |
wc = WordCloud(max_words=2000, max_font_size=256,random_state=42) | |
wc.generate(text) | |
plt.imshow(wc, interpolation="None") | |
plt.axis('off') | |
plt.show() | |
STOPWORDS = ['ver','essa','vez','nas','mas','qual','ele','ter','pois','este','vez','já','aos','pode','outro','artigo','desse','alguns','meio','entre','das','podem','esse','seu','também','são','quando','de', 'que','em','os','as','da','como','dos','ou','se','um','uma','para','na','ao','mais','por','não','ainda','muito','sua'] + list(STOPWORDS) | |
wc = WordCloud(stopwords=STOPWORDS,max_words=2000, max_font_size=256,random_state=42) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment