![](/img/trans.png)
[英]How do I read specific rows AND columns in CSV file while printing values within a certain range
[英]How do I read specific columns in a file and make them into a new csv
這是示例 1:
| district_id | date |
| -------- | ----------- |
| 18 | 1995-03-24 |
| 1 | 1993-02-26 |
樣本 2:
| link_id | type |
| -------- | ----------- |
| 9 | gold |
| 19 | classic |
我想收集樣本 1 的日期列和樣本 2 的類型列和 output 作為數據。csv
您可以使用數據幀的垂直連接然后渲染它:
df3 = pandas.concat([df1['date'], df2['type']], axis = 1)
df3.to_csv('data.csv')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.