Last active
September 2, 2019 17:37
-
-
Save rozanecm/38f2901c592bdffc40726cb0473318cf to your computer and use it in GitHub Desktop.
Some useful functions for when performing exploratory analysis with pandas.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file for title purpose only. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[beeper] Make sure to have sox installed (
sudo apt-get install sox
).