Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master

Conversation

@sourcery-ai
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot commented Apr 12, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from dmalberto April 12, 2023 14:20
b64 = base64.b64encode(csv.encode()).decode() # some strings <-> bytes conversions necessary here
href = f'<a href="data:file/csv;base64,{b64}">Download csv file</a>'
return href
return f'<a href="data:file/csv;base64,{b64}">Download csv file</a>'
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_table_download_link refactored with the following changes:

Comment on lines -48 to +47
st.markdown('Você selecionou : ' +str(select_method))
st.markdown(f'Você selecionou : {str(select_method)}')
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function main refactored with the following changes:

Comment on lines -7 to +14
chart = alt.Chart(df, width=600).mark_bar().encode(
alt.X(coluna, bin=True),
y='count()', tooltip=[coluna, 'count()']
).interactive()
return chart
return (
alt.Chart(df, width=600)
.mark_bar()
.encode(
alt.X(coluna, bin=True), y='count()', tooltip=[coluna, 'count()']
)
.interactive()
)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function criar_histograma refactored with the following changes:

Comment on lines -15 to +27
bars = alt.Chart(df, width = 600).mark_bar().encode(
x=alt.X(coluna_num, stack='zero'),
y=alt.Y(coluna_cat),
tooltip=[coluna_cat, coluna_num]
).interactive()
return bars
return (
alt.Chart(df, width=600)
.mark_bar()
.encode(
x=alt.X(coluna_num, stack='zero'),
y=alt.Y(coluna_cat),
tooltip=[coluna_cat, coluna_num],
)
.interactive()
)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function criar_barras refactored with the following changes:

Comment on lines -23 to -27
boxplot = alt.Chart(df, width=600).mark_boxplot().encode(
x=coluna_num,
y=coluna_cat
return (
alt.Chart(df, width=600)
.mark_boxplot()
.encode(x=coluna_num, y=coluna_cat)
)
return boxplot
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function criar_boxplot refactored with the following changes:

Comment on lines -30 to +42
scatter = alt.Chart(df, width=800, height=400).mark_circle().encode(
alt.X(x),
alt.Y(y),
color = color,
tooltip = [x, y]
).interactive()
return scatter
return (
alt.Chart(df, width=800, height=400)
.mark_circle()
.encode(alt.X(x), alt.Y(y), color=color, tooltip=[x, y])
.interactive()
)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function criar_scatterplot refactored with the following changes:

Comment on lines -68 to +112
mean = st.checkbox('Média')
if mean:
if mean := st.checkbox('Média'):
st.markdown(df[col].mean())
median = st.checkbox('Mediana')
if median:
if median := st.checkbox('Mediana'):
st.markdown(df[col].median())
desvio_pad = st.checkbox('Desvio padrão')
if desvio_pad:
if desvio_pad := st.checkbox('Desvio padrão'):
st.markdown(df[col].std())
kurtosis = st.checkbox('Kurtosis')
if kurtosis:
if kurtosis := st.checkbox('Kurtosis'):
st.markdown(df[col].kurtosis())
skewness = st.checkbox('Skewness')
if skewness:
if skewness := st.checkbox('Skewness'):
st.markdown(df[col].skew())
describe = st.checkbox('Describe')
if describe:
if describe := st.checkbox('Describe'):
st.table(df[colunas_numericas].describe().transpose())
st.subheader('Visualização dos dados')
st.image('https://media.giphy.com/media/Rkoat5KMaw2aOHDduz/giphy.gif', width=200)
st.markdown('Selecione a visualizacao')
histograma = st.checkbox('Histograma')
if histograma:
if histograma := st.checkbox('Histograma'):
col_num = st.selectbox('Selecione a Coluna Numerica: ', colunas_numericas,key = 'unique')
st.markdown('Histograma da coluna : ' + str(col_num))
st.markdown(f'Histograma da coluna : {str(col_num)}')
st.write(criar_histograma(col_num, df))
barras = st.checkbox('Gráfico de barras')
if barras:
if barras := st.checkbox('Gráfico de barras'):
col_num_barras = st.selectbox('Selecione a coluna numerica: ', colunas_numericas, key = 'unique')
col_cat_barras = st.selectbox('Selecione uma coluna categorica : ', colunas_object, key = 'unique')
st.markdown('Gráfico de barras da coluna ' + str(col_cat_barras) + ' pela coluna ' + col_num_barras)
st.markdown(
f'Gráfico de barras da coluna {str(col_cat_barras)} pela coluna '
+ col_num_barras
)
st.write(criar_barras(col_num_barras, col_cat_barras, df))
boxplot = st.checkbox('Boxplot')
if boxplot:
if boxplot := st.checkbox('Boxplot'):
col_num_box = st.selectbox('Selecione a Coluna Numerica:', colunas_numericas,key = 'unique' )
col_cat_box = st.selectbox('Selecione uma coluna categorica : ', colunas_object, key = 'unique')
st.markdown('Boxplot ' + str(col_cat_box) + ' pela coluna ' + col_num_box)
st.markdown(f'Boxplot {str(col_cat_box)} pela coluna ' + col_num_box)
st.write(criar_boxplot(col_num_box, col_cat_box, df))
scatter = st.checkbox('Scatterplot')
if scatter:
if scatter := st.checkbox('Scatterplot'):
col_num_x = st.selectbox('Selecione o valor de x ', colunas_numericas, key = 'unique')
col_num_y = st.selectbox('Selecione o valor de y ', colunas_numericas, key = 'unique')
col_color = st.selectbox('Selecione a coluna para cor', colunas)
st.markdown('Selecione os valores de x e y')
st.write(criar_scatterplot(col_num_x, col_num_y, col_color, df))
correlacao = st.checkbox('Correlacao')
if correlacao:
if correlacao := st.checkbox('Correlacao'):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function main refactored with the following changes:

df = pd.read_csv(self.path_train)
return df

return pd.read_csv(self.path_train)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function DataSource.read_data refactored with the following changes:

Comment on lines -38 to -39
else:
pass
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Preprocessing.process refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants