import pandas as pd
import openpyxl
# Read the CSV file
df = pd.read_csv("D:\\xxxt\\xx.csv") # Replace with the actual path of your CSV file
# Convert DataFrame to Excel
df.to_excel("D:\xx\xx.xlsx",index=False) # This will create a new Excel file
my output is like this, the number are stored as text. How to rectify this by storing as numbers
It looks like your csv file contains both numbers and text within the same column (row 12, “No.”). Pandas therefore stores the column as text, and exports it as text when creating the xlsx-file.
To fix it, you will need to remove the text entries from the column, and cast the column to your desired data type: