Skip to content

Instantly share code, notes, and snippets.

View data4sci's full-sized avatar

Robert Samarek data4sci

  • VSB - Technical University of Ostrava
  • Ostrava, Czech Republic
View GitHub Profile
@data4sci
data4sci / pandas_settings.py
Last active June 10, 2021 09:28
#pandas df display settings #python
pd.set_option('display.width', 1000)
pd.set_option('display.max_rows', 36)
pd.set_option('display.max_columns', 100)
pd.set_option('display.max_colwidth', -1)
@data4sci
data4sci / free.sh
Created June 10, 2021 09:19
free disk space
# zobrazí volné místo na disku
df -k .
@data4sci
data4sci / col_dtypes.py
Created June 10, 2021 09:20
počty dtypes pro smíšený sloupec (object) #python #pandas
df.column_1.apply(type).value_counts()
#a změnit vše na `str`
df[df.column_1.notna()] = df.astype({"column_1": str})
@data4sci
data4sci / clean.py
Created June 10, 2021 09:24
odstranit přebytečné mezery a \n z názvů sloupců #python #pandas
#odstranit přebytečné mezery a \n z názvů sloupců
df.columns = df.columns.str.strip().str.replace('\\n', ' ')
#
df.columns = df.columns.str.strip().str.replace('\\n', ' ').str.strip()
@data4sci
data4sci / clean_str.py
Created June 10, 2021 09:25
očistit přebývající mezery na začátku a konci řetězce #python #pandas
df['column_1'] = df['column_1'].str.strip()
@data4sci
data4sci / chord.py
Created June 10, 2021 09:26
chord diagram / holoviews
chord = hv.Chord((links_base, nodes)).select(value=(5, None))
chord.opts(
opts.Chord(cmap='Category20', edge_cmap='Category20', edge_color=dim('source').str(),
labels=None, node_color=dim('index').str(), width=700, height=700))
@data4sci
data4sci / tables.py
Created June 10, 2021 09:29
#python vypiš tabulky v databázi
for i,table in enumerate(Engine.table_names(), start=1): print(i, table)
@data4sci
data4sci / trash.sh
Created June 10, 2021 09:30
empty trash #bash
rm -rf ~/.local/share/Trash/*
@data4sci
data4sci / mac.sh
Created June 10, 2021 09:31
MAC address #bash
cat /sys/class/net/wlo1/address
cat /sys/class/net/*/address #všechny adaptéry
@data4sci
data4sci / gdrive
Created June 10, 2021 09:33
připojení Google Drive do systému (Linux Mint / Ubuntu)
# <https://www.reallinuxuser.com/how-to-install-and-setup-google-drive-on-linux-mint/>