Skip to content

Instantly share code, notes, and snippets.

@nonchris
Last active August 18, 2023 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nonchris/bb6afd3e331782d339a5e0071eb94a09 to your computer and use it in GitHub Desktop.
Save nonchris/bb6afd3e331782d339a5e0071eb94a09 to your computer and use it in GitHub Desktop.
things i did
"""
Things I did and always look up how I did it.
Feel free to suggest futher things you always forget :)
"""
# date format
f'{datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}'
# current directory
f"{os.getcwd()}/{file_name}"
# numpy array from csv (boulder scraper)
percentage, time = np.loadtxt(f,
delimiter=";",
skiprows=1,
comments="#",
dtype={
'names': ('percentage', 'time'),
'formats': ('i4', 'M8[m]')},
converters={
0: lambda i: i if i != b'None' else -10,
1: lambda t: dt.datetime.fromtimestamp(float(t))},
usecols=(0, 1),
unpack=True
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment