摘要:ref: Getting Started with Python in VS Code - Create a virtual environment To enable arcpy in VS Code, you need to configure your Python interpreter t
阅读全文
摘要:ref: Get the path of the current file (script) in Python: __file__ To get the directory of the current Python file, you can use the os.path module in
阅读全文
摘要:Exists: Determines the existence of the specified data object. This function tests for the existence of various data types including feature classes,
阅读全文
摘要:In the installation of packages in Jupyter Notebook, I encountered an issue. I installed packages using Command Prompt (CMD), but when I try to import
阅读全文
摘要:Firstly, we should define a function. def IsFlood(join_count): if join_count > 0: return "Yes" else: return "No" Secondly, we should call this functio
阅读全文
摘要:ref: Top 50 matplotlib Visualizations – The Master Plots (with full python code)
阅读全文
摘要:参考:numpy复制并扩充维度 参考:记录 之 numpy扩充某一维度,并重复填充 np.expand_dims():扩充数组的维度,并且制定扩充的维度位置,用axis来指定 repeat():用来复制数组内容在指定的维度上面 transpose():用来转置数组 1.numpy.expand_di
阅读全文
摘要:ref: [Pandas] 文本包含.str.contains() import pandas as pd df = pd.DataFrame([['liver','E',89,21,24,64], ['Arry','C',36,37,37,57], ['Ack','A',57,60,18,84],
阅读全文
摘要:Ref: country-converter 1.0.0 Ref: Python-pycountry | Understand How to Use pycountry These two python libraries are both used to process information a
阅读全文
摘要:参考:How to Replace Elements in NumPy Array (3 Examples) You can use the following methods to replace elements in a NumPy array: Method 1: Replace Eleme
阅读全文
摘要:参考:Add Months to datetime Object in Python ☀☀☀<< 举例 >>☀☀☀ # import packages import pandas as pd # adding months to a particular date present = '2022-0
阅读全文
摘要:Ref: From WKT format Firstly, we already have a dataframe, and there is a column of geometry. But this column is in the format of the string, therefor
阅读全文
摘要:参考:自定义颜色条教程 import matplotlib as mpl cmap = mpl.colors.ListedColormap(['yellow', '#E0E0E0']) africa_gdf.plot(column='hotspot_category', cmap=cmap, leg
阅读全文
摘要:Reference: Python for Data Analysis, 3E - Pandas pandas.DataFrame.merge 29-April-2024 use to_string() to print the entire DataFrame. Check the number
阅读全文
摘要:参考:geopandas--坐标系学习 gdf.crs = 'EPSG:4326'
阅读全文
摘要:参考:Converting list of polygons to multipolygon using shapely? MultiPolygon -> Polygon list list(multiPoly.geoms) Polygon list -> MultiPolygon shapely.
阅读全文
摘要:参考:pandas 筛选某个值在某个列表中 isin #筛选某个值在某个列表中 df = df[df['subject_1'].isin([1, 2, 13, 18, 25])]
阅读全文
摘要:参考:数据科学 | 避坑!Python特征重要性分析中存在的问题 模型代码(复制前一个博客的内容): 查看代码 from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_
阅读全文