程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

(data science learning records 139) list of important new features of geosandas version 0.11

編輯:Python

The sample code for this article has been uploaded to my Github Warehouse https://github.com/CNFeffery/DataScienceStudyNotes

1 brief introduction

Hello, everyone. I'm Mr. Fei , Just a few days ago ,geopandas Published its 0.11.0 Official version , From its previous version (0.10.2) Half a year has passed since the release , What important new features have been brought to us in this new version update , In today's article, I will take you to find out .

2 geopandas 0.11 List of important new features of version

You can geopandas Upgrade based on , You can also create a new virtual environment and install it directly 0.11.0 edition , In line with the principle of cautious taste , We can use the following command to create a new virtual environment at one go 、geopandas And related dependent installations , And install jupyterlab As IDE demonstrate :

conda create -n geopandas-env python=3.8 -c https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main -y
conda activate geopandas-env
conda install geopandas=0.11.0 pygeos pyogrio -c conda-forge -y
pip install jupyterlab -i https://pypi.douban.com/simple/

Execute the following commands in the terminal to verify whether it is correctly installed :

python -c "import geopandas as gpd;print(gpd.__version__)"

Everything is all set. , Let's take a look at some of the more important features in this update :

2.1 Faster vector file reading and writing

In the new version read_file() And to_file() Parameters are introduced engine Used to specify the engine on which to read and write common vector files , The default is the original 'fiona', Optional 'pyogrio', This is from geopandas Another library maintained by the development team , It can greatly improve the understanding of common vector file formats, such as shapefile Reading and writing speed , Take the reading of the whole building contour data in Guangzhou with millions of polygons as an example , new IO The engine brings near 5 Times the read performance :

And equally close 5 Times the write performance :

2.2 New rectangular cutting method with improved performance clip_by_rect()

0.11 New in for GeoSeries and GeoDataFrame Methods clip_by_rect(minx, miny, maxx, maxy), The target rectangular coordinate range can be passed in , Quickly cut out the vector within the rectangle , For example, we are based on the previously read building outline data of Guangzhou , Randomly generate the side length by the following function 10000 The rectangular range of meters is used as cutting material :

import numpy as np
import matplotlib.pyplot as plt
from shapely.geometry import box # Calculate the target GeoDataFrame Range
minx, miny, maxx, maxy = gdf.total_bounds def generate_random_rectangle(minx, miny, maxx, maxy):
'''
Randomly obtained within the scope of the study 100000 M side length rectangle
''' random_rectangle = [
np.random.uniform(minx, maxx - 10000),
np.random.uniform(miny, maxy - 10000)
] return [
*random_rectangle,
random_rectangle[0] + 10000,
random_rectangle[1] + 10000,
]

call clip_by_rect()

The returned result is consistent with the number of original vector records , Where presented GEOMETRYCOLLECTION EMPTY The record of indicates that it does not intersect with the target rectangle , We make use of is_empty To reverse filter out the vector records that have been trimmed :

besides , You can also direct [minx, miny, maxx, maxy] The input format is passed into the classic clip() Cutting method , It will call directly at the bottom clip_by_rect() And automatically return the effective vector cutting result :

2.3 Read and write correctly GIS Date time field in file

from 0.11.0 Version start ,geopandas When facing a date time field , Whether it is written to GIS File or from GIS File read in , Can be correctly resolved to date time type :

You can https://github.com/geopandas/geopandas/releases/tag/v0.11.0 See the full version update instructions , Overall speaking , There are not many important updates brought about by this new version update , But they are quite practical , You can use it on your own data .


The above is the whole content of this paper , Welcome to discuss with me in the comments section ~

( Data science learning notes 139)geopandas 0.11 More articles on the list of important new features in the version

  1. ( Data science learning notes 129)geopandas 0.10 List of important new features of version

    This article sample code and files have been uploaded to my Github Warehouse https://github.com/CNFeffery/DataScienceStudyNotes 1 brief introduction Not so long ago , We are very familiar with Python Geography ...

  2. ( Data science learning notes 75) be based on geopandas Spatial data analysis based on —— Coordinate reference system

    The corresponding code of this article has been uploaded to my Github Warehouse https://github.com/CNFeffery/DataScienceStudyNotes 1 brief introduction In the last article, we discussed geopandas Data nodes in ...

  3. ( Data science learning notes 42)folium Advanced content introduction

    One . brief introduction In the last article ( Data science learning notes 41) We have learned about folium Basic content of , actually folium The real excellence in geographic information visualization lies in the high degree of customization of the drawn images , This article will be based on folium Some of the official documents ...

  4. ( Data science learning notes 69) Detailed explanation pandas Medium map、apply、applymap、groupby、agg

    * From the beginning of this article, the data and code of all articles have been uploaded to my github Warehouse :https://github.com/CNFeffery/DataScienceStudyNotes One . brief introduction pandas There are a lot of ways ...

  5. ( Data science learning notes 72) use pdpipe build pandas Data analysis pipeline

    1 brief introduction In the data analysis task , Read in from raw data , By the end of the analysis , Most of the time in the middle is to process and regularize the data step by step , By assembly line (pipeline) This process is more conducive to carding the context of analysis , It is also more conducive to error checking and correction ...

  6. ( Data science learning notes 55) utilize ggthemr To beautify ggplot2 Images

    One . brief introduction R Medium ggplot2 It's a very powerful and flexible data visualization package , Familiar with its drawing rules, you can freely generate various visual images , But its default color and style are unavoidably too simple in many cases , This article will introduce the ggthemr The package is specifically for the original ...

  7. ( Data science learning notes 50) be based on Python Network data collection -selenium piece ( On )

    One . brief introduction And then a few months ago ( Data science learning notes 31) be based on Python Network data collection ( Elementary chapter ), In that article , We introduced the basics of web crawlers ( Basic request Library , Basic parsing library ,CSS, Regular expressions, etc ), In that article ...

  8. ( Data science learning notes 49)Scala Pattern matching in

    One . brief introduction Scala Pattern matching in is similar to Java Medium switch sentence , And more robust , This article will focus on Scala Some basic examples of pattern matching are introduced : Two .Scala Pattern matching in 2.1 The basic format Scala Medium mode match ...

  9. ( Data science learning notes 47) be based on Python The actual combat of network data collection (2)

    One . brief introduction I'm in my senior year , Recently in the summer internship , Outside the main business of data mining , Also help colleagues do a lot of network data collection content , The next few articles will be listed one by one , To continue to write a few months ago to open this network data collection practical pit . Two . Ma beehive reviews data collection ...

  10. ( Data science learning notes 44) stay Keras Training multi-layer perceptrons

    One . brief introduction Keras It has an autonomous set of front-end control Syntax , Backend based tensorflow and theano Deep learning framework , Because of its simple, fast and clear grammar style of building neural network , It can help users build their own neural network more quickly , It can be called depth ...

Random recommendation

  1. Progressive framework 、 Bottom up incremental development vue

    Official website vue.js It's like this : A set of tools for building user interfaces   Progressive framework . Unlike other heavyweight frameworks ,Vue Adopt the design of bottom-up incremental development . So what exactly is a progressive framework . What is bottom-up incremental development ? Actually, I think this ...

  2. Centos 6.5 install redis

    1. download wget http://download.redis.io/releases/redis-2.8.13.tar.gz 2. decompression tar zxvf redis-2.8.13.tar.gz 3. ...

  3. JS Regular expression usage and examples

    1. Define regular expressions : a. The ordinary way :var reg=/ expression / Additional parameters Attachment parameters : g: Represents that global matching can be performed .i: Represents a case insensitive match .m: Represents that multiple lines can be matched . The above three parameters , Any combination of , Stands for compound ...

  4. MongoDB Start of

    Set up... On the desktop or somewhere else mongodb.bat Batch file Write the following in it mongod --dbpath D:\java_tools\MongoDB\MongoDBDATA preservation - Then open the file ...

  5. [Poetize I] The door of the dark mage

    describe Description applepi There's only one door to the place of confinement , Local Call it “ The door of the dark mage ”. There's an undirected picture on this door , And the code to open this door is in the picture [ The degree of each point is greater than zero and is even ] The number pairs of subgraphs of ...

  6. python The eleventh day of operation and maintenance development (RabbitMQ,redis)

    One .RabbitMQ python Of Queue And RabbitMQ Understanding between : python Process or thread of Queue Can only python Self use .RabbitMQ Queue multiple applications share queues , Communicate with each other . 1. ordinary ...

  7. The first 3 Stage —— Kernel startup analysis prepare_namespace() How to mount the root file system and mtd Section Introduction (6)

    After the kernel starts and initializes , The ultimate goal is like Windows It can also start the application , stay windows Every application in the C disc .D Plate, etc. , and linux Each application in is stored in the root file system , So where is the root file system mounted , How to achieve ...

  8. Kompose: Docker-compose To Kubernetes The migration tools

    Docker So that everyone can learn from Docker Registry Start a packaged Docker application .Docker-Compose stay Docker On this basis, the dependency startup problem between multi container applications is solved . Docker ...

  9. Linux Common command - Delete file

    During the test , Sometimes you need to delete some files , For example, the log file is too large , Here is a summary of some common methods for deleting files Take the files in this system as an example Delete file ( That is, the file is deleted ) Single delete :rm -f + file name eg:rm -f  2 ...

  10. Redis Basics 、 Advanced features and performance tuning

    This article will start from Redis Start with the basic characteristics of , By telling Redis Data structure and main command pairs of Redis The basic ability of . And then the Overview Redis Advanced capabilities offered , And deploy . maintain . Performance tuning and other aspects of more in-depth introduction and guidance . ...


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved