小编xin*_*xin的帖子

如何在python中将字典格式的txt文件转换为dataframe?

我有一个包含以下数据的文件,

{"cid": "ABCD", "text": "alphabets", "time": "1 week", "author": "xyz"}
{"cid": "EFGH", "text": "verb", "time": "2 week", "author": "aaa"}
{"cid": "IJKL", "text": "noun", "time": "3 days", "author": "nop"}
Run Code Online (Sandbox Code Playgroud)

我希望读取这个文件并创建一个像这样的数据框,

cid     text    time    author
ABCD    alpha   1week   xyz
EFGH    verb    2week   aaa
IJKL    noun    3days   nop
Run Code Online (Sandbox Code Playgroud)

python dictionary file pandas

4
推荐指数
1
解决办法
648
查看次数

如何将列表[List [Long]]转换为列表[List [Int]]?

在Scala中将List[List[Long]]a 转换为a 的最佳方法是List[List[Int]]什么?

例如,给定以下类型的列表 List[List[Long]]

val l: List[List[Long]] = List(List(11, 10, 11, 10, 11), List(8, 19, 24, 0, 2))
Run Code Online (Sandbox Code Playgroud)

怎么转换成List[List[Int]]

scala type-conversion

3
推荐指数
2
解决办法
145
查看次数

标签 统计

dictionary ×1

file ×1

pandas ×1

python ×1

scala ×1

type-conversion ×1