从R改为Python我很难使用pandas从多个数据帧的列表中编写多个csv:
import pandas
from dplython import (DplyFrame, X, diamonds, select, sift, sample_n,
sample_frac, head, arrange, mutate, group_by, summarize,
DelayFunction)
diamonds = [diamonds, diamonds, diamonds]
path = "/user/me/"
def extractDiomands(path, diamonds):
for each in diamonds:
df = DplyFrame(each) >> select(X.carat, X.cut, X.price) >> head(5)
df = pd.DataFrame(df) # not sure if that is required
df.to_csv(os.path.join('.csv', each))
extractDiomands(path,diamonds)
但这会产生错误。谢谢你的建议!在
欢迎来到Python!首先,我将加载两个库并下载一个示例数据集。在
示例数据的前几行:
^{pr2}$现在我想你要做的是:
最后,我的文件夹}
'scratch'
有三个新的csv,分别是dataset_0.csv
,dataset_1.csv
,和{相关问题 更多 >
编程相关推荐