Skip to content
Advertisement

Tag: python

executing .py in html/php

I wrote a Python script which writes its output into a txt file. Then I included that file in my html/php website. – works good so far. Only remaining problem: I can’t execute the .py file automatically while opening the site. I know that this isn’t the best solution <?PHP exec(“python3 Auswertung.py”); ?> doesn’t seem to work Answer I used

Print Query Result in Console – Robot Framework

I’m using Robot Framework in automations. Now I’m adding SQL Server scripts. In order to facilitate, I would like to make a print of my query (select) to display in the console. How do I do? I tried with the following way, but without success: and The latter prints to the console, but the query sent, in this case, select

Convert SQL commands to Python

I have the following code in SQL: I’ve been trying to rewrite it in python like so: but I keep getting a generic error message. What am I doing wrong? EDIT: added the error message Answer IIUC, you could try the following: The equivalent of SELECT DISTINCT col is drop_duplicates(col) and the equivalent of SELECT col, count(*) is value_counts(col).

How can I Insert multiple rows with one query

I made a code allowing me to GET data from an API and insert it into a database. But I encounter a problem my api contains about 20 million data and to insert everything in my database it will take me 43 days 🙂 I think the problem comes from the fact that I insert the data one by one.

pyodbc is returning binary data in char field

pyodbc with driver “iSeries Access ODBC Driver” is returning binary output, Ex: original data in the table: B06300 what it returns: b’xc2xf0xf6xf3xf0xf0@@@@@@@@@@@@@@@@@@@@@@@@’ My code: I tried putting add_output_converter and encoder to connection but didn’t work Answer I suspect the problem is that the data is defined on the server as CCSID 65535, which means to not translate the data. Using

find timestamp difference between 2 columns with sqldf

According to this answer: https://stackoverflow.com/a/25863597/12304000 We can use something like this in mysql to calculate the time diff between two cols: How can I achieve the same thing with pandasql? I tried these: but they throw an error that: Answer From the PandaSQL documentation: pandasql uses SQLite syntax. The link in your post is for MySQL. Here is a reference

Advertisement