Exemplo n.º 1
0
    for area in idx1:
        tempHour.append(tempArea.count(area))
    datas4.append(tempHour)

columns = idx3
fmtdict = {}

for i in range(len(idx3)):
    fmtdict[idx3[i]] = datas4[i]
print(fmtdict)
df4 = pd.DataFrame(fmtdict, columns=idx3, index=idx1)
df4.to_excel(writer, "By區和時段", startrow=0, startcol=0)
writer.save()

#畫圖
wbook = lwb(fileName)  #openpyxl.workload不接受.xls
chart1 = BarChart()
chart1.type = "col"
chart1.style = 5
chart1.title = "合計by區"
chart1.height = 10
chart1.width = 20
wsheet = wbook["DataBy區"]
data = Reference(wsheet,
                 min_col=wsheet.min_column + 1,
                 min_row=wsheet.min_row,
                 max_row=wsheet.max_row - 1)
cats = Reference(wsheet,
                 min_col=wsheet.min_column,
                 min_row=wsheet.min_row + 1,
                 max_row=wsheet.max_row - 1)
Exemplo n.º 2
0
import numpy as np
from openpyxl import load_workbook as lwb


def char_range(r1, r2):
    for c in range(ord(r1), ord(r2) + 1):
        yield chr(c)


fname = input('input name file excel: ')
s = input('input row index: ')
n = input('input number of data: ')
sname = input('input generating data name: ')
cp = input('input column index range: ')
wb = lwb(fname + '.xlsx')
sheet = wb['Sheet1']
a = [[sheet[c + str(i)].value for c in char_range(cp[0], cp[1])]
     for i in range(int(s),
                    int(n) + int(s))]
np.save(sname + '.npy', a)
Exemplo n.º 3
0
from openpyxl import load_workbook as lwb
from google_images_download import google_images_download
import concurrent.futures
import sys

# creating object
response = google_images_download.googleimagesdownload()
#global output,limit,cd
output = r'D:\Food_imgs_download_30_9_3'
range = sys.argv[1]
fmt = sys.argv[2]
limit = 1500
cd = r'C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe'

wb = lwb("List of Dishes based on Cuisines.xlsx")
ws = wb["Sheet1"]
categories = list(a[0].value for a in list(ws[range]))
print(categories)
print(len(categories))


def downloadimages(category):
    # keywords is the search query
    # format is the image file format
    # limit is the number of images to be downloaded
    # print urs is to print the image file url
    # size is the image size which can
    # be specified manually ("large, medium, icon")
    # aspect ratio denotes the height width ratio
    # of images to download. ("tall, square, wide, panoramic")
    arguments = {