TerryChan' Blog

文章

标签

喜欢

标签: pandas

共找到 113 篇相关文章

第 1 页,共 12 页

文章预览

How to Rename a Column in Pandas
2023年08月22日 356 字

There are multiple ways to rename a column in Pandas. Here are three common methods: 1. Using the `rename()` method: ``` df.rename(columns={'old_name':'new_name'}, inplace=T…

阅读全文
浏览 评论

文章预览

pandas 数据
2023年08月22日 529 字

pandas 数据快速 处理成标签数据 =================== ``` from sklearn import preprocessing le = preprocessing.LabelEncoder() le.fit(df.fruit) df['categorical_label'] = le.transform(df.fruit…

阅读全文
浏览 评论

文章预览

pandas datetime转换为时间戳
2023年08月22日 347 字

> ```python > df\_date = df['截止日期'].apply(str) > > 用to\_datetime()函数将字符串转换成时间格式,并增加'时间'字段 > ====================================== > > df['截止日期'] = pd.to*datetime(df*date,form…

阅读全文
浏览 评论

文章预览

Pandas 删除列操作
2023年08月22日 660 字

在 Pandas 中执行此操作的最佳方法是使用[`drop`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop.html): ``` df = df.drop('column\_name', 1) ``` 其中`1`是*轴*号(`0`对于…

阅读全文
浏览 评论

文章预览

Pandas plot绘制图表是使用plotly作为后端渲染
2023年08月22日 567 字

流行的Pandas数据分析和操作工具在其DataFrame和Series对象上提供了绘图功能,这些对象在历史上曾产生过matplotlib的图。从0.25版本开始,Pandas提供了一个使用不同后端的机制,从plotly的4.8版本开始,你现在可以使用Plotly Express支持的后端来进行Pandas绘图。这意味着你现在可以直接从数据框中生成交互式绘…

阅读全文
浏览 评论