Skip to content

Import fixes#161

Closed
TQZhang04 wants to merge 9 commits intoUCSD-E4E:poetryfrom
TQZhang04:import-fixes
Closed

Import fixes#161
TQZhang04 wants to merge 9 commits intoUCSD-E4E:poetryfrom
TQZhang04:import-fixes

Conversation

@TQZhang04
Copy link
Copy Markdown
Contributor

Added resampy to toml and lock files
Corrected pd.df.append to pd.concat
other minor fixes

Comment thread PyHa/IsoAutio.py
annotations = new_entry
else:
annotations = annotations.append(new_entry)
annotations = pd.concat([annotations, new_entry])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

``So for concat, its a bit slower if we append each row to a dataframe. According to the docs its slightly better to instead save each new_entry to a list then concat the list.

So basically

list = []
for i in etc:
list.append(some new row for a future df)
df = pd.concat(list)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got it. TBH I was just doing a find and replace for this PR, didn't fully look at all the context. I'll go back and make the necessary changes

Copy link
Copy Markdown
Contributor

@Sean1572 Sean1572 left a comment

Choose a reason for hiding this comment

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

See comments. Make sure to make a list of rows then concat so we don't call concat over and over again in each for loop. According to https://pandas.pydata.org/docs/reference/api/pandas.concat.html its better practice


# Open file with librosa (uses ffmpeg or libav)
print("Path: ", path)
# Open file with librosa (uses ffmanaeg or libav)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change ffmanaeg back to ffmpeg

Comment thread PyHa/statistics.py
statistics_df = clip_stats_df
else:
statistics_df = statistics_df.append(clip_stats_df)
statistics_df = pd.concat([statistics_df,clip_stats_df])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same note about concatenation here in pandas

Comment thread PyHa/statistics.py
start_time = time.time()
if num_errors > 0:
checkVerbose("Something went wrong with" + num_errors + "clips out of" + str(len(clips)) + "clips", verbose)
checkVerbose(f"Something went wrong with {num_errors} clips out of {len(clips)} clips", verbose)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

good change!

Comment thread PyHa_Tutorial.ipynb
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Make sure to remove pyha tutorial from PR before submit

@sprestrelski sprestrelski deleted the branch UCSD-E4E:poetry November 29, 2023 20:07
@TQZhang04 TQZhang04 mentioned this pull request Nov 29, 2023
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.

3 participants