Skip to content

Instantly share code, notes, and snippets.

@rozanecm
Last active September 2, 2019 17:37
Show Gist options
  • Save rozanecm/38f2901c592bdffc40726cb0473318cf to your computer and use it in GitHub Desktop.
Save rozanecm/38f2901c592bdffc40726cb0473318cf to your computer and use it in GitHub Desktop.
Some useful functions for when performing exploratory analysis with pandas.
Empty file for title purpose only.
# source: https://gist.github.com/rozanecm/38f2901c592bdffc40726cb0473318cf
import os
for file in os.listdir('../data/'):
print(file + '\t\t\t\t\t\t' + str(os.stat("../data/" + file).st_size/1000000))
# source: https://gist.github.com/rozanecm/38f2901c592bdffc40726cb0473318cf
# This will allow you to see all column names & rows when you are doing .head().
# None of the column names will be truncated.
# source: https://stackoverflow.com/questions/49188960/how-to-show-all-of-columns-name-on-pandas-dataframe
pd.set_option('display.max_columns', None)
# pd.set_option('display.max_rows', None)
# source: https://gist.github.com/rozanecm/38f2901c592bdffc40726cb0473318cf
# Function which plays a beep of given duration and frequency.
# Useful for when executing things that need a while to finish, to get notified.
import os
def beep(duration = 1, freq = 1500):
""" play tone of duration in seconds and freq in Hz. """
os.system('play --no-show-progress --null --channels 1 synth %s sine %f' % (duration, freq))
@rozanecm
Copy link
Author

rozanecm commented Jun 22, 2019

[beeper] Make sure to have sox installed (sudo apt-get install sox).

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