我有以下文件(file1.xlsx)作为输入。在这个文件中,我总共有32列和近2500行。举个例子,我在屏幕打印中提到了5列
I want to edit same file with python and want output as (file1.xlsx)it should be noted I am adding one column named as short and data is a kind of substring up to first decimal of data present in name(A) column of same excel.
请你请帮助
RegardsKawaljeet
解决方案:
这里是你需要什么…
import pandas as pd
file_name = "file1.xlsx"
df = pd.read_excel(file_name) #Read Excel file as a DataFrame
df['short'] = df['Name'].str.split(".")[0]
df.to_excel("file1.xlsx")