Conversation
| 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>' |
There was a problem hiding this comment.
Function get_table_download_link refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| st.markdown('Você selecionou : ' +str(select_method)) | ||
| st.markdown(f'Você selecionou : {str(select_method)}') |
There was a problem hiding this comment.
Function main refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| 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() | ||
| ) |
There was a problem hiding this comment.
Function criar_histograma refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| 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() | ||
| ) |
There was a problem hiding this comment.
Function criar_barras refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| 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 |
There was a problem hiding this comment.
Function criar_boxplot refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| 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() | ||
| ) |
There was a problem hiding this comment.
Function criar_scatterplot refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| 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'): |
There was a problem hiding this comment.
Function main refactored with the following changes:
- Use named expression to simplify assignment and conditional [×11] (
use-named-expression) - Use f-string instead of string concatenation [×5] (
use-fstring-for-concatenation)
| df = pd.read_csv(self.path_train) | ||
| return df | ||
|
|
||
| return pd.read_csv(self.path_train) |
There was a problem hiding this comment.
Function DataSource.read_data refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| else: | ||
| pass |
There was a problem hiding this comment.
Function Preprocessing.process refactored with the following changes:
- Remove redundant pass statement (
remove-redundant-pass)
Branch
masterrefactored 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
masterbranch, then run:Help us improve this pull request!