Abstract The inversion of precipitable water vapor (PWV) using the Global Navigation Satellite System (GNSS) has advantages such as all-weather observation, high precision, low cost, and high temporal resolution. Currently, long-term GNSS-PWV data has become an important data source for studying climate change. However, due to factors such as equipment failures, observation technology limitations, and estimation model errors, missing data and outliers often occur in real-time or post-processed PWV time series data. Furthermore, the main sources of GNSS-PWV errors are influenced by the atmospheric weighted mean temperature (Tm) and surface meteorological data (pressure and temperature). The results indicate that the European Centre for Medium⁃Range Weather Forecasts Reanalysis v5 (ERA5) dataset exhibits high accuracy in the Chinese region, making it suitable for GNSS-PWV inversion. By utilizing ERA5 meteorological data to calculate hourly GNSS-PWV and conducting accuracy assessments, it is demonstrated that the PWV inverted based on GNSS and ERA5 meteorological parameters possesses high precision. Based on this, this study selects GNSS stations from the Crustal Movement Observation Network of China (CMONOC) where the proportion of missing measured data is less than 8%. By combining ERA5, random forest (RF), and particle swarm optimization (PSO) algorithms, a new model called PSORF is proposed to fill in missing values in GNSS-PWV time series data. The research findings reveal that the R2 and RMSE of PSORF-PWV are 0.98 and 2.16 mm, respectively. Additionally, GNSS stations with more than 8% missing measured data are utilized to validate the accuracy of the PSORF model. A comparative analysis is conducted between the results obtained through the PSORF model and the ERA5-PWV acquired via traditional interpolation methods. The MAE and RMSE of PSORF-PWV are reduced by 21% and 17%, respectively, indicating that the PSORF model excels in filling missing data and effectively enhances the accuracy and reliability of PWV time series analysis. This study not only presents an effective approach for processing missing PWV data but also evaluates the applicability and accuracy of the ERA5 dataset in PWV inversion. This provides crucial technical support and data security for climate change research, short-term humidity field forecasting, and studies in related fields.