pandas合并pd.concat-pd.merge
pandas 合并数据常用的两个函数:
pd.concat https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.concat.html
pd.merge https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.merge.html
刚好有一个对比 RNN 和 LSTM 神经网络运行结果的场景分别用到了这两个函数:
- 采用 concat 合并两个csv表; csv表为两次运行结果的,列名基本一致。
- 采用 merge 合并模型运行条件类似的表, 用于对比数据
Win10-WSL-Ubuntu22.04-openmc 安装与配置
一、WSL 安装 Ubuntu22.04
启用 WSL
打开 Microsoft Store,安装 Ubuntu22.04
设置源,更新
ref: https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
更新:sudo apt update
升级:sudo apt upgrade
- 安装 ZSH、oh-my-zsh
二、安装 openmc
ref: https://docs.openmc.org/en/stable/quickinstall.html
参照 Installing from Source on Ubuntu,安装 openmc。
安装完成后,运行
openmc
试一下, 提示错误: 找不到材料数据卡cross_sections.xml
。下载材料数据集
1 | git clone https://github.com/openmc-dev/data openmc-dev_data |
使用 scoop 安装管理 windows 软件(4):安装包解压密码
ref: https://github.com/ScoopInstaller/Scoop/issues/4390
0. 问题: scoop 本身不支持安装包有解压密码的自动解压。
scoop 本身不支持安装包有解压密码的自动解压。因此在安装 MAS 时会卡在解压处,无法继续安装。
1. 7z 命令手册
7z 命令是支持的: 7z x FILENAME.7z -pPWD -oOUTDIR
2. 查 Scoop 源码的解压函数
找到 Scoop 源码里的 “~\scoop\apps\scoop\current\lib\decompress.ps1” 文件。
文件封装了 Expand-7zipArchive
函数命令, 但参数没有能将密码传入的方法。
3. 试 Scoop 的 pre_install
Scoop Wiki 里提到了 pre_install 等说法。
在 MAS.json 中加入:
1 | "pre_install": "7z x $dir\\$fname -p1234 $('-o' + $dir)", |
尝试了很多次还是不起作用,Scoop的策略是遇到压缩包先执行解压、再做后续的事情。所以这一句不会被执行,安装程序依旧卡在解压处,无法继续安装。
ESP8266 Micropython 配置
0. 设置
板子型号:ESP-12E
0.1 安装 windows 驱动:CP2102
- https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads
- CP210x_Universal_Windows_Driver
0.1 安装 esptool
1 | pip install esptool |
群晖 VSCode Remote 配置
1. 客户端 VSCode 安装 Remote 插件
安装插件, 略
添加远程连接 aaa@192.168.1.xxx, 连接、等待, 输入密码
2. 连接时可能连不上,并出现警告
警告:
The remote host may not meet VS Code Server's prerequisitesfor glibc and libstdc++
日历:从在线日历获取事件
从在线日历获取事件
Outlook 查看日历链接: 设置-日历-共享日历-发布日历,可以看到如下链接:
“https://outlook.live.com/owa/calendar/d82e6afe-XXXX-XXXX/cid-YYYY/calendar.ics“
1 | from ics import Calendar |
使用 scoop 安装管理 windows 软件(3):自己制作一个安装配置文件
ref: (https://github.com/ScoopInstaller/Scoop/wiki/App-Manifests)
尝试自己制作一个安装配置文件, 软件是 N_m3u8DL-RE
。
1 | { |
zsh & oh-my-zsh 安装配置
1 安装 zsh
1 | sudo apt install zsh |
2 安装 ohmyzsh
ref: https://ohmyz.sh/
- 用 wget 安装。
1 | sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" |
有时候会出现 443 网路错误,可手动下载、安装 install.sh
1 nano zsh-install.sh打开 https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh
将安装代码全部复制进去
1
2 sudo chmod +x zsh-install.sh
./zsh-install.sh
3 安装 ohmyzsh (gitee 源)
ref: https://gitee.com/mirrors/oh-my-zsh.git
1 | sh -c "$(wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh -O -)" |
4 配置 ohmyzsh (gitee 源)
- 打开配置文件
1 | nano ~/.zshrc |
- 修改如下:
1 | # 主题 |
- 也可以用命令修改:
1 | sed -i 's/^ZSH_THEME=.*/ZSH_THEME="ys"/g' .zshrc |
- 下载插件
1 | git clone https://gitee.com/mirrors/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions |
ref: https://github.com/zsh-users/zsh-autosuggestions
ref: https://github.com/zsh-users/zsh-syntax-highlighting
- 加载配置文件, 使生效
1 | source ~/.zshrc |
===
1 | sudo apt install zsh -y |
用树莓派 pico w 和墨水屏做一个 mnist-clock
用 raspberry pico w 和墨水屏做一个 mnist-clock
1. 墨水屏
- 型号:Pico-ePaper-2.9
- https://www.waveshare.net/wiki/Pico-ePaper-2.9
- 工作电压:3.3V/5V
- 通信接口:SPI
- 分辨率:296 x 128
- 显示颜色:黑、白
- 局部刷新:0.3s
- 全局刷新 :2s
2. pico w 基本配置
2.1 刷固件
下载类似
rp2-pico-w-20221107-unstable-v1.19.1-616-g5987130af.uf2
首次将 pico w 连接电脑之后,会以U盘形式弹出来,把固件拖进去。
已经刷过固件的,按着板子上的 BOOTTSEL 按钮连接电脑。
重新上电,固件就自动刷好了。
2.2 开发环境 thonny
- 安装 thonny,
scoop install thonny
- Thonny IED: 打开 ‘运行’ - ‘配置解释器’, 配置一下
- 运行一下板载的 LED 测试程序:
1 | from machine import Pin |
可以看到板载的 LED 在闪烁。
使用leancloud存储运行日志
- 申请 leancloud 应用。
- 安装
pip install leancloud
1 |
|
群晖安装aria2
群晖型: DS218+,
CPU: Intel Celeron J3355
DSM版本: 7.0
1. 安装 bootstrap
1 | wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/syno-i686-bootstrap_1.2-7_i686.xsh |
2. 安装 aria2
1 | ipkg update |
access-python调用odbc数据库
1. 安装 Access (以access 2016 为例)
- 安装 Access 2016: 略
- 安装 Microsoft Access Database Engine
- https://www.microsoft.com/zh-CN/download/details.aspx?id=54920
- accessdatabaseengine_X64.exe 2020/8/11 File Size: 79.5 MB
2. 安装 pyodbc
1 | pip install pyodbc |
3. 新建数据库并进行操作
日历文件:将csv文件转换为ics
日历文件:将csv文件转换为ics
1 | # pip install icalendar |
文件替换:保留原始路径
文件替换:保留原始路径
问题描述:将特定类型文件的文件挑出来,放入一个文件夹,批量处理之后再替换原文件。
1. 文件迁移
- 将文件路径经过md5加密后,作为文件名前缀。
- 复制文件到一个新文件夹
1 | # xyz_a.py |
- 用命令行运行:
1 | python xyz_a.py > zzz.csv |
使用 winget 安装管理 windows 软件 - Win10 LTSC
0 Winget官网
Winget官网: https://github.com/microsoft/winget-cli
1. 安装 winget (Win10 LTSC)
目前官方只支持 windows store 安装,但 LTSC 并没有应用商店。
1 | 版本 Windows 10 企业版 LTSC |
Win10 手动安装 winget 方法如下:
1.1 安装 VC++ v14 依赖
1 | cd ~ |
1.2 安装 Microsoft.UI.Xaml 依赖
下载、解压、安装 appx:
1 | cd ~ |
1.3 安装 winget
- 下载页面:https://github.com/microsoft/winget-cli/releases
- 下载、安装 msixbundle
1 | cd ~ |
powershell配置(6)-ohmyposh3-v2
1.安装
以scoop安装oh-my-posh。
1 | # |
2. 配置文件
新建、修改配置文件,运行:
1 | if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force } |
加入以下内容:
1 |
|
Git Bash 安装 zsh 和 on-my-zsh
ref: (https://dominikrys.com/posts/zsh-in-git-bash-on-windows/)
1. 安装 zsh
https://packages.msys2.org/package/zsh?repo=msys&variant=x86_64
- 1.1 从 MSYS2 下载 zsh package
1 | aria2c -c -s 8 -x 8 https://mirror.msys2.org/msys/x86_64/zsh-5.8-5-x86_64.pkg.tar.zst |
- 1.2 解压
压缩文件的格式是ZST
, 需要安装一个支持的解压软件
1 | scoop install zstd |
将 \etc
、\usr
文件夹解压到本机 git 的安装目录:
- 1.3 运行
1 | zsh |
- 设置 zsh 自启动, 在
~/.bashrc
加入:
1 | if [ -t 1 ]; then |