This file contains hidden or 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 pandasUteis.pandas_utils import frequency_by_natural_order, frequency_by_buckets | |
| df = pd.read_csv('/home/francisco/Projects/Pycharm/' | |
| 'matplot-pandas-tutorial/files/questionario.csv') | |
| """ | |
| Criando um histograma para com os pesos dos alunos | |
| """ | |
| peso = df['Peso'] |
This file contains hidden or 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 | |
| import pandas as pd | |
| def frequency_by_natural_order(dataframe, column): | |
| """ | |
| Create a dataframe that gives the total by natural order, frequencies, | |
| accumulated total and frequency per item. | |
| Dataframe output example: | |
| tot freq tot_ac freq_ac |
This file contains hidden or 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 pl | |
| import matplotlib.pyplot as plt | |
| df = pl.read_csv('questionario.csv') | |
| with open('questionario.txt', 'w') as f: | |
| df.to_string(f) |
This file contains hidden or 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 matplotlib.pyplot as plt | |
| """ | |
| Lendo de um arquivo de texto | |
| """ | |
| with open('annual-real-gnp-us-1909-to-1970.txt, 'r') as f: | |
| # Usando a expressão regular para o separador indicando que eles são os | |
| # espaços em braco | |
| df = pd.read_table(f, sep='\s+') |
This file contains hidden or 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 pl | |
| import matplotlib.pyplot as plt | |
| """ | |
| Incluindo texto no gráfico | |
| """ | |
| dataframe = pl.read_csv('annual-real-gnp-us-1909-to-1970.csv') | |
| font_1 = {'family':'serif', 'color':'#FFFC19', 'fontsize':'large' } | |
| font_2 = {'family':'fantasy', 'color':'yellow', 'size':'16'} |
This file contains hidden or 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 pl | |
| import matplotlib.pyplot as plt | |
| """ | |
| Annotates dentro de um box | |
| """ | |
| dataframe = pl.read_csv('annual-real-gnp-us-1909-to-1970.csv') | |
| plt.figure(figsize=(8, 6)) | |
| plt.plot(dataframe['Year'], dataframe['GNP']) |
This file contains hidden or 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 pl | |
| import matplotlib.pyplot as plt | |
| """ | |
| Incluindo annotates | |
| """ | |
| dataframe = pl.read_csv('annual-real-gnp-us-1909-to-1970.csv') | |
| plt.figure(figsize=(8, 6)) | |
| plt.plot(dataframe['Year'], dataframe['GNP']) |
This file contains hidden or 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 pl | |
| import matplotlib.pyplot as plt | |
| """ | |
| Lendo um arquivo .csv com pandas e criando um pandas data frame | |
| """ | |
| dataframe = pl.read_csv('/home/francisco/Projects/Pycharm/matplot-pandas-tutorial' | |
| '/files/annual-real-gnp-us-1909-to-1970.csv') | |
| plt.figure(figsize=(8, 6)) |
This file contains hidden or 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 | |
| import matplotlib.pyplot as plt | |
| """ | |
| Selecionando posição das legendas | |
| """ | |
| x = np.arange(1, 11) | |
| print(x) | |
| plt.figure(figsize=(6, 4)) |
This file contains hidden or 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 | |
| import matplotlib.pyplot as plt | |
| """ | |
| Inserindo titulo e legendas | |
| """ | |
| x = np.arange(1, 11) | |
| print(x) | |
| plt.figure(figsize=(6, 4)) |