python - 如何查看 geopandas 数据框中的所有列?
问题描述
这是我尝试过的:
# load shape file
shpfile = r"...\PycharmProject\maps\CA_Counties\CA_Counties_TIGER2016.shp"
map_df = gpd.read_file(shpfile);
map_df.set_option('display.max_columns',None)
print(map_df.head())
但它只显示一些列,类似于数据框。
解决方案
尽管 Geopandas 扩展了 Pandas,但您仍然需要导入 Pandas 才能使用set_option
. 然后,您的所有选项都将转移到您的 Geopandas 数据框中。
对原始代码的这种修改应该有效:
import geopandas as gpd
import pandas as pd
# change the global options that Geopandas inherits from
pd.set_option('display.max_columns',None)
# load shape file
shpfile = r"...\PycharmProject\maps\CA_Counties\CA_Counties_TIGER2016.shp"
map_df = gpd.read_file(shpfile);
print(map_df.head())
推荐阅读
- mysql - 关系数据库模式设计 - 如何直接从实体的字段集建模一对一映射
- go - scanner.Scan() 在 GoLand 调试器中挂起
- r - R 问题:如何创建一个包含 2 个变量的直方图?
- string - 如何在haskell中的空格后拆分字符串?
- java - AndroidStudio 无法在模拟器上保存文件
- apache-spark - 如何避免错误消息 java.lang.ClassCastException spark sql 2.3.1
- python - 使用 Cython 进行多处理时出错
- php - 将扫描的 QR 内容传递给 PHP
- perl - Perl:为文件夹内的 csv 文件选择文件路径
- spring - 我如何在春季从 cookie 中读取安全值?