Part 1. 安装
-
R
devtools::install_github("wesm/feather/R")
-
Python
pip install feather-format
Part 2. 使用
-
Python中读取、保存
import feather # 读取 df = pd.read_feather('R_data.feather') df # 保存 df.to_feather('data.feather')

报错原因:将DataFrame存储为.feather文件时,需要DataFrame的index为默认的顺序,因此需要将index更改为默认的顺序。
import feather
df = df.reset_index()
df.to_feather('data.feather')
即可保存成功

-
R语言读取、保存
library(feather) df <- read_feather('df_diff_from new and old.feather') View(df)

path <- "R_data.feather"
write_feather(df, path)
参考
https://blog.csdn.net/tanzuozhev/article/details/51088949
https://zhuanlan.zhihu.com/p/247025752
Part 3. 访问剪切板
-
Python
import pyperclip pyperclip.copy("hello, world") # 将文字复制进剪切板 pyperclip.paste() # 将文字从剪切板复制出来
-
R
# 将剪切板数据读入 read.table(pipe("pbpaste"),header = F) # 将剪切板数据输出 clip<-pipe("pbcopy","w") write.table(path,file=clip) close(clip)
网友评论