Skip to content

Commit a0e63db

Browse files
committed
Add practices/pandas/merge_excel_rows.py
1 parent efd220c commit a0e63db

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

practices/pandas/merge_excel_rows.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/python3
2+
# -*- coding: utf-8 -*-
3+
# 技术支持:https://www.jianshu.com/u/69f40328d4f0
4+
# 技术支持 https://china-testing.github.io/merge_excel_rows.html
5+
# https://github.com/china-testing/python-api-tesing/blob/master/practices/pandas/merge_excel_rows.py
6+
# 项目实战讨论QQ群630011153 144081101
7+
# CreateDate: 2018-12-06
8+
import pandas as pd
9+
10+
frame = pd.read_csv("test.csv")
11+
df = frame.groupby(['state', 'year']).sum()
12+
df.to_csv("out.csv")
13+
14+
15+
16+
17+

practices/pandas/out.csv

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
state,year,pop
2+
Nevada,2001,2.4
3+
Nevada,2002,2.9
4+
Nevada,2003,3.3000000000000003
5+
Ohio,2000,1.5
6+
Ohio,2001,1.7
7+
Ohio,2002,3.6

practices/pandas/test.csv

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
state,year,pop
2+
Ohio,2000,1.5
3+
Ohio,2001,1.7
4+
Ohio,2002,3.6
5+
Nevada,2001,2.4
6+
Nevada,2002,2.9
7+
Nevada,2003,3.2
8+
Nevada,2003,0.1

practices/pil_merge.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
import math
1010
from PIL import Image
1111

12-
column = 2
12+
column = 11
1313
width = 802
1414
height = 286
1515
size = (802, 286)
1616

1717
list_im = [r'd:\code.jpg', r'd:\code.jpg', r'd:\code.jpg', r'd:\code.jpg',
1818
r'd:\code.jpg', r'd:\code.jpg', r'd:\code.jpg', r'd:\code.jpg',
1919
r'd:\code.jpg', r'd:\code.jpg', r'd:\code.jpg']
20-
list_im = list_im*11
2120
imgs = [Image.open(i) for i in list_im]
2221

2322
row_num = math.ceil(len(imgs)/column)

0 commit comments

Comments
 (0)