alex_bn_lee

导航

随笔分类 -  Python Study

1 2 3 4 5 ··· 31 下一页

Study of Python.
[1127] Find the closest point to each polygon
摘要:You can use sjoin_nearest() from geopandas to find the closest point to each polygon. Here's how: Example Code import geopandas as gpd # Ensure both G 阅读全文

posted @ 2025-06-17 13:23 McDelfino 阅读(11) 评论(0) 推荐(0)

[1124] Force Pandas to keep the values as they appear
摘要:When reading an Excel file, Pandas may automatically convert text-based numeric values into numbers. For instance, the string '0008000300' will be int 阅读全文

posted @ 2025-05-15 09:24 McDelfino 阅读(17) 评论(0) 推荐(0)

[1123] Find the table index based on the text before the table
该文被密码保护。

posted @ 2025-04-24 14:21 McDelfino 阅读(0) 评论(0) 推荐(0)

[1118] Change Shortcut Target Using a Batch File
摘要:Steps to Change Shortcut Target Using a Batch File: Create a Batch File: Open Notepad. Write the following code in Notepad: @echo off set "shortcutPat 阅读全文

posted @ 2025-03-07 14:07 McDelfino 阅读(18) 评论(0) 推荐(0)

[1117] Remove some pages from a PDF while preserving the bookmarks
摘要:To remove the last page from a PDF while preserving the bookmarks, you can use the PyMuPDF library (fitz package) instead of PyPDF2, as PyMuPDF provid 阅读全文

posted @ 2025-03-05 14:10 McDelfino 阅读(32) 评论(0) 推荐(0)

[1116] Python Regular Expression (re)
摘要:ref: Python RegEx - geeksforgeeks A Regular Expression or RegEx is a special sequence of characters that uses a search pattern to find a string or set 阅读全文

posted @ 2025-03-05 07:08 McDelfino 阅读(56) 评论(0) 推荐(0)

[1115] Python re library examples
摘要:Ref: Python RegEx To find a pattern like "Page " followed by a number in a string, you can use the `re` (regular expressions) module in Python. Here's 阅读全文

posted @ 2025-02-27 08:29 McDelfino 阅读(25) 评论(0) 推荐(0)

[1114] Extract the Dataframe from a table on the webpage
摘要:Here is the screenshot of the webpage. Here are the copied texts. Legislation and compliance News and media NSW Environment Protection Authority (EPA) 阅读全文

posted @ 2025-02-25 12:28 McDelfino 阅读(9) 评论(0) 推荐(0)

[1113] Extract the list of items from a dropdown menu on a HTML text
摘要:Following the scripts from the previous blog, here is another example: from bs4 import BeautifulSoup html = """<select name="dbcboNarrowSearchNoticeTy 阅读全文

posted @ 2025-02-25 12:01 McDelfino 阅读(7) 评论(0) 推荐(0)

[1112] Extract the list of items from a dropdown menu on a webpage
摘要:To extract the list of items from a dropdown menu on a webpage, you can use web scraping tools like BeautifulSoup and Selenium in Python. Here's a ste 阅读全文

posted @ 2025-02-24 13:41 McDelfino 阅读(18) 评论(0) 推荐(0)

[1111] Convert a tab-separated text to a pandas DataFrame
摘要:To convert a tab-separated text to a pandas DataFrame, you can use the pandas library. Here's how you can do it: Install pandas (if you haven't alread 阅读全文

posted @ 2025-02-24 13:39 McDelfino 阅读(15) 评论(0) 推荐(0)

[1110] GeoPandas - Merging Data
摘要:References: https://geopandas.org/en/stable/docs/user_guide/mergingdata.html#merging-data There are two ways to combine datasets in GeoPandas - attrib 阅读全文

posted @ 2025-02-21 12:08 McDelfino 阅读(46) 评论(0) 推荐(0)

[1099] Extract the text from HTML
摘要:Here's an example using Python with the BeautifulSoup library to get the text inside the <option> tags: from bs4 import BeautifulSoup html = ''' <opti 阅读全文

posted @ 2025-02-19 10:17 McDelfino 阅读(6) 评论(0) 推荐(0)

[1098] Getting Started with the DeepSeek API
摘要:References: Getting Started with the DeepSeek API Making API Requests with Python Now that you have your API key and necessary dependencies, you’re re 阅读全文

posted @ 2025-02-18 12:21 McDelfino 阅读(37) 评论(0) 推荐(0)

[1097] Converting 3D geometries to 2D geometries in a GeoDataFrame
摘要:MultiPolygon import geopandas as gpd from shapely.geometry import MultiPolygon, Polygon # Sample GeoDataFrame with 3D multipolygons data = {'geometry' 阅读全文

posted @ 2025-02-14 13:46 McDelfino 阅读(14) 评论(0) 推荐(0)

[1090] Use Python to compare the files in two folders and merge their contents
摘要:You can use Python to compare the files in two folders and merge their contents. Here’s a simple approach using the filecmp and shutil modules to reco 阅读全文

posted @ 2025-01-14 07:01 McDelfino 阅读(49) 评论(0) 推荐(0)

[1085] GitHub Resources and Tools
摘要:Ref: About GitHub and Git About GitHub GitHub is cloud-based platform where you can store, share, and work together with others to write code. Storing 阅读全文

posted @ 2025-01-09 10:37 McDelfino 阅读(16) 评论(0) 推荐(0)

[1084] Setting Up PyQGIS for Standalone Scripts on Windows: A Step-by-Step Guide
该文被密码保护。

posted @ 2024-12-12 07:33 McDelfino 阅读(0) 评论(0) 推荐(0)

[1083] Information extraction from the NetCDF (.nc) file
该文被密码保护。

posted @ 2024-12-10 08:18 McDelfino 阅读(0) 评论(0) 推荐(0)

[1082] QGIS tools, Clip raster by mask layer, Raster calculator, Polygonize, Clip
该文被密码保护。

posted @ 2024-12-09 11:56 McDelfino 阅读(0) 评论(0) 推荐(0)

1 2 3 4 5 ··· 31 下一页