假设我有一个数据帧df
,如下所示:
id geojson
0 1010020478 {"name": "entities", "type": "FeatureCollectio...
1 1010020478 {"name": "entities", "type": "FeatureCollectio...
2 1010020478 {"name": "entities", "type": "FeatureCollectio...
3 1010020478 {"name": "entities", "type": "FeatureCollectio...
4 1010020478 {"name": "entities", "type": "FeatureCollectio...
5 1010020478 {"name": "entities", "type": "FeatureCollectio...
6 1010020478 {"name": "entities", "type": "FeatureCollectio...
7 1010020478 {"name": "entities", "type": "FeatureCollectio...
8 1010020478 {"name": "entities", "type": "FeatureCollectio...
9 1010020478 {"name": "entities", "type": "FeatureCollectio...
我想计算每一行的"type": "e"
或"type":"e"
的数量
{
"name": "entities","type": "FeatureCollection","features": [
{
"type": "Feature","geometry": {
"type": "Polygon","coordinates": [
[
[
17.11460135135052,9.38631
],[
15.205521351350516,9.38631
],[
15.205521351350516,16.22718
],[
25.228191351350503,16.22718
],[
25.228191351350503,23.38623
],[
7.728291351350526,23.38623
],[
7.728291351350526,0
],[
17.11460135135052,0
],[
17.11460135135052,9.38631
]
]
]
},"properties": {
"area": "104","name": "201","type": "e","Layer": "0","SubClasses": "AcDbEntity:AcDbBlockReference","EntityHandle": "120A"
}
},{
"type": "Feature","geometry": {
"type": "Polygon","coordinates": [
[
[
33.1826913513505,23.38623
],[
25.228191351350503,23.38623
],[
25.228191351350503,16.22718
],[
33.1826913513505,16.22718
],[
33.1826913513505,23.38623
]
]
]
},"properties": {
"area": "125","name": "202","type": "e","Layer": "0","SubClasses": "AcDbEntity:AcDbBlockReference","EntityHandle": "1223"
}
},{
"type": "Feature","geometry": {
"type": "Polygon","coordinates": [
[
[
25.228191351350503,16.22718
],[
15.205521351350516,16.22718
],[
15.205521351350516,9.38631
],[
25.228191351350503,9.38631
],[
25.228191351350503,16.22718
]
]
]
},"properties": {
"area": " ","name": " ","type": " ","Layer": "0","SubClasses": "AcDbEntity:AcDbBlockReference","EntityHandle": "1232"
}
},{
"type": "Feature","geometry": {
"type": "Polygon","coordinates": [
[
[
33.1826913513505,16.22718
],[
25.228191351350503,16.22718
],[
25.228191351350503,9.38631
],[
26.182731351350505,9.38631
],[
33.1826913513505,9.38631
],[
33.1826913513505,16.22718
]
]
]
},"properties": {
"area": "22","name": " ","type": "p","Layer": "0","SubClasses": "AcDbEntity:AcDbBlockReference","EntityHandle": "123D"
}
},{
"type": "Feature","geometry": {
"type": "Polygon","coordinates": [
[
[
38.1144813513505,14.95446
],[
33.18269135135051,14.95446
],[
33.18269135135051,9.38631
],[
38.1144813513505,9.38631
],[
38.1144813513505,14.95446
]
]
]
},"properties": {
"area": "20","name": " ","type": "t","Layer": "0","SubClasses": "AcDbEntity:AcDbBlockReference","EntityHandle": "1267"
}
}
]
}
我试过:
from collections import Counter
z = [""type": "e"", ""type":"e""]
df.geojson.str(Counter(z))
但我得到SyntaxError: invalid syntax
。
请帮帮我。谢谢。你知道吗
以下是我的解决方案:
相关问题 更多 >
编程相关推荐