摘要:参考:numpy复制并扩充维度 参考:记录 之 numpy扩充某一维度,并重复填充 np.expand_dims():扩充数组的维度,并且制定扩充的维度位置,用axis来指定 repeat():用来复制数组内容在指定的维度上面 transpose():用来转置数组 1.numpy.expand_di
阅读全文
摘要:参考:python中scale的用法_在netCDF4和Python中使用scale_factor和add_offset的示例? 参考代码: import netCDF4 as nc dir_path = "./2m_temperature/03_TIFF/" files = os.listdir(
阅读全文
摘要:参考:How to convert NetCDF to GeoTIFF? 参考:利用Python(netCDF4库)读取.nc文件(NetCDF气象数据文件)的基本操作 参考:经度转换0°-360°与-180°-180°之间的相互转换 参考:https://blog.csdn.net/weixin_
阅读全文
摘要:ref: Pandas新增一列并按条件赋值? 把下图中的 NaN 都赋值为 0 df.loc[条件判断, 'value'] = 0 m = pd.merge(gdf_africa, df_af_mp, how='left', on='country') m.loc[m['value'].isna()
阅读全文
摘要:Suppose we have a dataframe, it has a column of "country". It lists different names of country's names, and for one country maybe it has multiple reco
阅读全文
摘要: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.
阅读全文
摘要:参考:Formula to Find Bearing or Heading angle between two points: Latitude Longitude 计算三角函数的时候,需要将经纬度的度数转换为弧度制,最后再将计算出来的弧度制转换为角度 def bearing_lonlat(phi_
阅读全文
摘要:参考:How to Use R and Python Together? Try These 2 Packages 实现功能:在 Python 代码中运行 R 文件,得到结果再在 Python 里面操作! import subprocess res = subprocess.call("Rscrip
阅读全文
摘要:参考:Mapping and Plotting Tools 参考:geopandas.GeoDataFrame.plot 参考:Choosing Colormaps 参考:geopandas,用python分析地理空间数据原来这么简单! 参考:「GIS教程」Python-GeoPandas地图、专题
阅读全文
摘要:参考:PySe-023-pandas.read_csv 读取 csv 文件,指定列数据类型 解决字符串数据列变为数字的问题 参考:Read a delimited file (including CSV and TSV) into a tibble Python:根据具体的列名指定数据格式 impo
阅读全文
摘要:参考:pandas: Rename column/index names (labels) of DataFrame rename(columns={字典}) 例子: print(df.rename(columns={'A': 'Col_1', 'C': 'Col_3'})) # Col_1 B C
阅读全文
摘要:参考:Pandas条件筛选并赋值实用操作一例 选择不包含以下两个值的其他内容 df_130 = df2[(df2['.region_id'] != 25025000703) & (df2['.region_id'] != 25025000504)]
阅读全文
摘要:参考:rpy2 学习笔记 参考:在python中使用R|rpy2
阅读全文