| - | - |
|---|---|
| NAME | Numpy cheatsheet |
| URL | https://quickref.me/numpy |
| DESCRIPTION | NumPy is the fundamental package for scientific computing with Python. This cheat sheet is a quick reference for NumPy beginners. |
This file contains hidden or 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
| import time | |
| import logging | |
| # Setup | |
| logging.basicConfig(level=logging.INFO, format='%(message)s') | |
| logger = logging.getLogger() | |
| # Test print | |
| start = time.perf_counter() | |
| for i in range(100000): |
This file contains hidden or 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
| # Standard imports | |
| import os | |
| # Library imports | |
| import yaml | |
| # Local imports |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| import streamlit as st | |
| import snowflake.connector | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| import seaborn as sns | |
| from dotenv import load_dotenv | |
| import os | |
| from snowflake.snowpark import Session | |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # listgitfiles.sh | |
| # List raw GitHub URLs for files in a repo or subfolder, filtered by extensions. | |
| # Full README is embedded and printed only with: listgitfiles.sh -h|--help | |
| set -euo pipefail | |
| # ------------------------- Minimal Help (usage) ------------------------- | |
| print_min_help() { | |
| cat <<'USAGE' |
- If values are integers in [0, 255], Parquet will automatically compress to use 1 byte unsigned integers, thus decreasing the size of saved DataFrame by a factor of 8.
- Partition DataFrames to have evenly-distributed, ~128MB partition sizes (empirical finding). Always err on the higher side w.r.t. number of partitions.
- Pay particular attention to the number of partitions when using
flatMap, especially if the following operation will result in high memory usage. TheflatMapop usually results in a DataFrame with a [much] larger number of rows, yet the number of partitions will remain the same. Thus, if a subsequent op causes a large expansion of memory usage (i.e. converting a DataFrame of indices to a DataFrame of large Vectors), the memory usage per partition may become too high. In this case, it is beneficial to repartition the output offlatMapto a number of partitions that will safely allow for appropriate partition memory sizes, based upon the
tmux new- Create and attach to a new session.tmux new -s NAME_HERE- Create and attach to a new session named NAME_HERE.CTRL-b, d- Detach (i.e. exit) from the currently-opened tmux session (alternatively,tmux detach). Note, this means press and holdCTRL, pressb, release both, pressd.tmux ls- Show list of tmux sessions.tmux a- Attach to the previously-opened tmux session.tmux a -t NAME_HERE- Attach to the tmux session named NAME_HERE.CTRL-d- Delete (i.e. kill) currently-opened tmux session (alternativelytmux kill-session).CTRL-b, [- Enter copy mode, and enable scrolling in currently-opened tmux session. Pressqto exit.CTRL-b, "- Split window horizontally (i.e. split and add a pane below).
grep -aisElr 'search string here' ./*-a-> search files as strings (this finds strings in note annotations)-i-> ignore case-s-> suppress errors-E-> use extended regular expressions-l-> only show the filename(s); remove this to see the line where the search string was found-r-> search recursively
- Use
:grepfor Grep searching within Vim.
NewerOlder