Tag: python3.x

Python / MySQL:表没有得到更新

我正在从一个Excel工作表中提取数据并将数据存入数据库的学校项目。 运行下面的代码并运行SQL命令SELECT * FROM items后,它将返回“空集”。 我究竟做错了什么? 我在这里先向您的帮助表示感谢! import openpyxl import MySQLdb as mdb db = mdb.connect('localhost', 'root', 'TRM4611', 'practice') cur = db.cursor() wb_choice = input('What workbook would you like to use?\n–> ') wb = openpyxl.load_workbook(wb_choice + '.xlsx') all_sheets = wb.get_sheet_names() with db: for sheet in all_sheets: current_sheet = wb.get_sheet_by_name(sheet) print ('\nCurrent Sheet: ' + current_sheet.title) […]

inferSchema使用spark.read.format(“com.crealytics.spark.excel”)推断datetypes列的double

我正在PySpark( Python 3.6和Spark 2.1.1 )上工作,并尝试使用spark.read.format(“com.crealytics.spark.excel”)从excel文件中获取数据,但是推断出datetypes为double柱。 例: input – df = spark.read.format("com.crealytics.spark.excel").\ option("location", "D:\\Users\\ABC\\Desktop\\TmpData\\Input.xlsm").\ option("spark.read.simpleMode","true"). \ option("treatEmptyValuesAsNulls", "true").\ option("addColorColumns", "false").\ option("useHeader", "true").\ option("inferSchema", "true").\ load("com.databricks.spark.csv") 结果: Name | Age | Gender | DateOfApplication ________________________________________ X | 12 | F | 5/20/2015 Y | 15 | F | 5/28/2015 Z | 14 | F | 5/29/2015 打印架构 […]

美丽的汤:提取天气信息:表 – > Excel文件

我想从本网站的表格中提取数据 天气历史表 我需要的 提取<table class="responsive"> <tbody> <table class="responsive"> \ <tbody> \ <tr>中所有<td>所有内容 使用整个数据从python生成一个Excel文件。 我不需要的 数字旁边的所有单位(即:22°C)(我不想<span>在<td> ) <td class="data-cell alt-cell">33.8 <span class="table-unit">°C</span></td> 在<tbody> \ <tr class="column-heading">和<tr class="row-subheading">排除重复标题 任何人都可以显示和解释我将如何在Excel文件中提取这些数据? HTML代码 <table id="history_table" class="responsive"> <thead> <tr class="column-heading"> <th class="year-cell">2016</th> <th colspan="3">Temperature</th> <th colspan="3">Dew Point</th> <th colspan="3">Humidity</th> <th colspan="3">Speed</th> <th colspan="3">Pressure</th> <th>Precip. Accum.</th> </tr> <tr class="row-subheading"><th>Sep</th> <th class="alt-cell">High</th> <th […]