去掉表格里某一列单元格的所有后缀

根据代码

python 复制代码
import pandas as pd

# 加载数据
file_path = 'your_data_file.csv'  # 替换为您的文件路径
data = pd.read_csv(file_path)

# 去掉 'name' 列中所有单元格的 '.jpg' 后缀
data['name'] = data['name'].str.replace('.jpg', '', regex=False)

# 显示修改后的前几行数据
print(data.head())

# 可选:将修改后的数据保存为新的 CSV 文件
# output_file = 'modified_data.csv'
# data.to_csv(output_file, index=False)
# print(f"Data saved to {output_file}")
相关推荐
_Jimmy_3 小时前
Agent 溯源精度提升方案
人工智能·python·langchain
SamChan904 小时前
在Web应用中集成PDF多语言翻译功能:PDFTranslator API实战指南
前端·python·ai·pdf·yapi·机器翻译
天天进步20154 小时前
Python全栈项目--智能办公自动化系统
开发语言·python
颜酱4 小时前
09 | 重构项目结构
人工智能·python·langchain
kisloy5 小时前
【爬虫入门第8讲】Python爬虫反爬入门
开发语言·爬虫·python
Sisphusssss6 小时前
香橙派5plus GPIO
linux·python·ubuntu
颜酱7 小时前
08 | 把维度值同步到 Elasticsearch(生成阶段)
人工智能·python·langchain
久久学姐7 小时前
基础转码学 AI:Java+Python 双语言入门,3 个月可落地实战项目
java·python·ai·转码·实战项目
ZHOU_WUYI7 小时前
4. light wam 模型loss计算过程
开发语言·人工智能·python
nwsuaf_huasir7 小时前
【无标题】
python