Every line of 'renaming multiple columns in pandas' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
420 def df_column_types_rename(df): 421 result = [df[x].dtype.name for x in list(df.columns)] 422 result[:] = [x if x != 'object' else 'string' for x in result] 423 result[:] = [x if x != 'int64' else 'integer' for x in result] 424 result[:] = [x if x != 'float64' else 'double' for x in result] 425 result[:] = [x if x != 'bool' else 'boolean' for x in result] 426 427 return result
62 def matchColumnNames(df): 63 return df.rename( 64 columns={ 65 "id": "vehicle_id", 66 "heading": "direction", 67 "secsSinceReport": "seconds_since_report", 68 "lat": "latitude", 69 "lon": "longitude", 70 "routeTag": "line" 71 } 72 )
813 def merge(old_cols, new_cols): 814 return old_cols + new_cols