Skip to content

Conversation

@SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

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

git fetch https://github.com/sourcery-ai-bot/data-storyteller main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Comment on lines -23 to +25



Copy link
Author

Choose a reason for hiding this comment

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

Found the following improvement in Function app:

Comment on lines -25 to +26


Copy link
Author

Choose a reason for hiding this comment

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

Function app refactored with the following changes:

"""

# Load the data
# Load the data
Copy link
Author

Choose a reason for hiding this comment

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

Function app refactored with the following changes:

This removes the following comments ( why? ):

# Table to store model and accurcy

Comment on lines -26 to +51

# Use two column technique
col1, col2 = st.beta_columns(2)

global name, type
# Design column 1
name = col1.selectbox("Select Column", data.columns)

# Design column two
current_type = col_metadata[col_metadata['column_name'] == name]['type'].values[0]
print(current_type)
column_options = ['numeric', 'categorical','object']
current_index = column_options.index(current_type)

type = col2.selectbox("Select Column Type", options=column_options, index = current_index)

st.write("""Select your column name and the new type from the data.
To submit all the changes, click on *Submit changes* """)


if st.button("Change Column Type"):

# Set the value in the metadata and resave the file
# col_metadata = pd.read_csv('data/metadata/column_type_desc.csv')
st.dataframe(col_metadata[col_metadata['column_name'] == name])

Copy link
Author

Choose a reason for hiding this comment

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

Found the following improvement in Function app:

if 'models' in os.listdir('../'):
return True
return False
return 'models' in os.listdir('../')
Copy link
Author

Choose a reason for hiding this comment

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

Function checkDir refactored with the following changes:


def app():

Copy link
Author

Choose a reason for hiding this comment

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

Found the following improvement in Function app:

Comment on lines -42 to +46

elif is_numeric_dtype(df[col[i]]):
ColumnType.append((col[i],"numerical"))
Numerical.append(col[i])

Copy link
Author

Choose a reason for hiding this comment

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

Found the following improvement in Function genMetaData:

Comment on lines -54 to +55
uniqueVals = list(np.unique(col))
uniqueVals.sort()
dict_ = {uniqueVals[i]: i for i in range(len(uniqueVals))}
return dict_
uniqueVals = sorted(np.unique(col))
return {uniqueVals[i]: i for i in range(len(uniqueVals))}
Copy link
Author

Choose a reason for hiding this comment

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

Function makeMapDict refactored with the following changes:

Comment on lines -69 to +68
redunt = []
k = 0
for ind, c in enumerate(corr[y]):
if c<1-threshold:
redunt.append(cols[ind])
return redunt
return [cols[ind] for ind, c in enumerate(corr[y]) if c<1-threshold]
Copy link
Author

Choose a reason for hiding this comment

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

Function getRedundentColumns refactored with the following changes:

Comment on lines -77 to +71
newDF = df.drop(columns2Drop, axis = 'columns')
return newDF
return df.drop(columns2Drop, axis = 'columns')
Copy link
Author

Choose a reason for hiding this comment

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

Function newDF 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.

1 participant