博文

目前显示的是 二月, 2025的博文

ibis 中使用duckdb

import duckdb import pandas as pd import numpy as np import ibis from ibis import _ import ibis . selectors as s import ibis . expr . operations as ops ibis . options . interactive = True # Create a DuckDB connection # con = duckdb.connect('/mnt/d/duckdb.db') # # Create a table # con.execute("CREATE TABLE XG as select * from read_csv_auto('/mnt/c/Users/xuefliang/Downloads/新冠存疑2.csv')") # con.sql('SHOW ALL TABLES') con = ibis . connect ( "duckdb:/mnt/d/duckdb.db" ) # con.create_table( #     "penguins", ibis.examples.penguins.fetch().to_pyarrow(), overwrite = True # ) con . list_tables () xg = con . table ( "XG" ) xg . head () (     xg     . group_by ( "YM_PH" )     . aggregate (         count = lambda _ : _ .count(),         distinct_count = lambda _ : _ .ZJHM.nunique()     ) ) tmp = (     xg     . mutate ( CSRQ = _ .CSRQ.cast( "string" ))     ...

系统中的 liblzma.so.5 版本过低

  首先,备份现有的 liblzma.so.5: <BASH> sudo cp /usr/lib/x86_64-linux-gnu/liblzma.so.5 /usr/lib/x86_64-linux-gnu/liblzma.so.5.backup 根据查找结果,你的系统中有一个更新版本的 liblzma.so.5 在 miniforge3 目录下。使用这个更新版本替换系统的版本: <BASH> sudo cp /home/xuefliang/miniforge3/pkgs/liblzma-5.6.3-hb9d3cd8_1/lib/liblzma.so.5 /usr/lib/x86_64-linux-gnu/liblzma.so.5 更新系统的动态链接库缓存: <BASH> sudo ldconfig 然后重新尝试安装 duckdb 包: <R> install.packages("duckdb")

R 连接数据库

library(duckdb) con = dbConnect(duckdb(), dbdir = "local.duckdb") # 从CSV创建表 dbExecute(con, "     CREATE TABLE persons AS      SELECT * FROM read_csv_auto('/mnt/c/Users/xuefe/Downloads/persons.csv') ") # 写入 R 中的数据框 dbWriteTable(con, "table_iris", iris) dbWriteTable(con, "table_mtcars", mtcars) dbListTables(con) dbGetQuery(con, "SELECT Species, COUNT(*) AS n                  FROM table_iris                  GROUP BY Species                  ORDER BY n;") # 断开数据库连接 dbDisconnect(con) ###############PostgreSQL library('RPostgreSQL') # create a connection # save the password that we can "hide" it as best as we can by collapsing it pw <- {   "xuefliang" } # loads the PostgreSQL driver drv <- dbDriver("PostgreSQL") # creates a connection to the postgres database # note that "con" will be used later in each connection to the da...

启用媒体流

使用 Win10 的DLNA流媒体功能,需要启动服务 Windows Media Player Network Sharing Service 如果出现该服务不能正常启动,或者“控制面板\所有控制面板项\网络和共享中心\媒体流选项” 不能正常启动,那么你可以尝试进行如下检查: 1、检查 SSDP Discovery 服务是否已经正常启动 2、检查 UPnP Device Host 服务是否已经正常启动 3、检查 Windows Search 服务是否已经正常启动 4、然后操作 Windows Media Player Network Sharing Service 服务是否可以正常启动 5、检查组策略中“计算机配置>管理模板>Windows组件>Windows Medis Player” 的 “阻止媒体共享” 的状态,需要设置为 “已禁用” 或 “未配置” 6、然后打开 “Windows Media Player > 媒体流 > 启用媒体流”,启用媒体流 7、正常情况,现在应该一切正常了,你可以玩转 DLNA 功能了。