mm_*_*_AA 6 merge converters dataframe python-3.x pandas
如何转换df.info()成data_frame。
我希望能够将此数据框与其他数据框合并。
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 458 entries, 0 to 457
Data columns (total 9 columns):
Name 457 non-null object
Team 457 non-null object
Number 457 non-null float64
Position 457 non-null object
Age 457 non-null float64
Height 457 non-null object
Weight 457 non-null float64
College 373 non-null object
Salary 446 non-null float64
dtypes: float64(4), object(5)
memory usage: 32.3+ KB
Run Code Online (Sandbox Code Playgroud)
小智 1
您可以写入文本文件:
import io
buffer = io.StringIO()
df.info(buf=buffer)
i = buffer.getvalue()
with open("df_info.txt", "w", encoding="utf-8") as f:
f.write(i)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2821 次 |
| 最近记录: |