Skip to main content

Python

 Ranaming a column in data frame




Writing the Read data into Excel sheet

  • Here if_sheet_exists = 'replace' will overite the data in the sheet if the sheet exists already
import pandas as pd
#Data frame
partspec_insert=df[['PartId', 'PartRev', 'AddedBy']]
#Write the DataFrame to a new sheet in the same Excel file
with pd.ExcelWriter(file, engine='openpyxl', mode='a', if_sheet_exists = 'replace') as writer:
      partspec_insert.to_excel(writer, sheet_name='Processed Data', index=False)







Moving file to destination folder after processing


import os
import shutil
destination_folder_path=r'C:\Users\BK2\Desktop\Test Folder\Processed Files'
shutil.move(file, os.path.join(destination_folder_path, os.path.basename(file)))
Print('Files moved to Destination Folder')





Drop Duplicates from Dataframe






Comments

Popular posts from this blog

Herbal Plants

Herbal plants to grow in home Different types of keerai ----- http://www.indiandietrecipes.com/2016/03/pictures-of-various-types-of-greens-or.html Pirandai ----good for bone joins---- https://youtu.be/k2DGubyXLAE Valarai Keerai Benifits ----- https://youtu.be/33HIfLJKTqA Sesma seeds ---- https://easyayurveda.com/2011/02/24/sesame-and-sesame-oil-benefits-total-ayurveda-details/

Convex Lens Vs Concave Lens

What is a Lens A lens is a transparent object that transmits light across it, and its working principle depends on the   law of refraction (Snell’s law) . Applications: Concave Lens help with Far-Sight Convex Lens help with Near-Sight

What is Verbal and Non-Verbal communication

TYPES OF COMMUNICATIONS: