Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercício semana 10 #23

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions exercicios/para-casa/casa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime

df = pd.read_csv(r"C:/Users/Colaborador/Reprograma/on33-python-s10-pandas-numpy-II/material/Employee.csv")

current_year = datetime.now().year # Pegar o ano atual
df['YearsAtCompany'] = current_year - df['JoiningYear']

df = df.drop_duplicates()
gender_group = df.groupby('Gender').size()

print(gender_group)

gender_group.plot(kind='bar', title='Distribuição por Gênero')
plt.xlabel('Gênero')
plt.ylabel('Número de Empregados')
plt.show()


age_group = df.groupby('Age').size()
print(age_group)

age_group.plot(kind='bar', title='Distribuição por Idade')
plt.xlabel('Idade')
plt.ylabel('Número de Empregados')
plt.show()

city_group = df.groupby('City').size()
print(city_group)

mean_service_time_by_city = df.groupby('City')['YearsAtCompany'].mean()
print(mean_service_time_by_city)

city_group.plot(kind='bar', title='Número de Empregados por Cidade')
plt.xlabel('Cidade')
plt.ylabel('Número de Empregados')
plt.show()
35 changes: 34 additions & 1 deletion exercicios/para-sala/aula.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
import pandas as pd
<<<<<<< HEAD

df = pd.read_csv(r"C:\Users\Colaborador\Reprograma\on33-python-s10-pandas-numpy-II\material\desenvolvimento_paises.csv")

#print(df.describe())
#print(df.info())
#print(df["AveragScore"].value_counts())

# print (df.fillna(0, inplace=True))
# print (df.isnull().sum())
# print (df.duplicated().sum())
# print (df.drop_duplicates(inplace=True))
# print (df.duplicated().sum())

# pais_maior_security_value = df["SafetySecurity"].max()
# pais_menor_security_value = df["SafetySecurity"].min()

# print(pais_maior_security_value)
# print(pais_menor_security_value)
# print("A diferença entre o maior pais com SafetySecurity é de:", pais_maior_security_value)

# print (pais_maior_security_value)
# print (pais_menor_security_value)
# print ("A diferença entre o maior pais com SafetySecurity é de: ", pais_maior_security_value)

# linha_maior_valor_security = df["SafetySecurity"]== pais_maior_security_value
# print (linha_maior_valor_security)

# index_greater_value = df["SafetySecurity"].idxmax()
# print(df.loc[index_greater_value])

=======
import matplotlib.pyplot as plt

df = pd.read_csv(r"C:\Projetos\Reprograma\on33-python-s10-pandas-numpy-II\material\desenvolvimento_paises.csv")
Expand Down Expand Up @@ -66,4 +98,5 @@ def categorizar_valores(valor):
print(personel_freedom_filter.info())

print(df.sort_values(by=["Education", "Health"], inplace=True, ascending=False))
print(df.head())np.nan
print(df.head())np.nan
>>>>>>> 50041aaf1b397c4277ed53a9f9391bab6871415d