Python& R-羽化包 - 如何更改默认写目录?

时间:2018-03-26 18:48:07

标签: python r feather

我在Googling 1+ Hour之后放弃了。在这里我的目标是存储我的羽毛文件来自R和Python不同的胜利(除了默认" C:\ Users \ murali")。 我正在为R和Python使用Jupyter笔记本

非常感谢你的帮助!!

R代码

library(feather)
path <- "my_data.feather5"
write_feather(mtcars, path)
df <- read_feather(path)

Python编码

import feather
import pandas as pd
import numpy as np
arr = np.random.randn(10000) # 10% nulls
arr[::10] = np.nan
df = pd.DataFrame({'column_{0}'.format(i): arr for i in range(10)})
feather.write_dataframe(df, 'test.feather')

1 个答案:

答案 0 :(得分:0)

R中(将工作目录设置为新的默认值):

setwd("C:\Users\murali")

Python

os.chdir("C:\Users\murali")