Skip to content

Tag: python

Create a database in python where user inputs the data?

I would like the program to ask the user for information (i.e. age and name) and for this information to be put into the database. I have tried the following: The error that keeps appearing is: I have Python 3.7 and I work in spyder. Answer Try this, student_name is a string and should be enclosed in single q…

Pandas dataframe combine unique row values

I have a dataframe like the following with over 90000 rows. As you can see, some origin and destination values repeat for example there are multiple rows where origin=101011001, destination=101011002. My goal is to group the repeating origin and destination values and sum the the people column, so the datafra…

How to parse quotes correctly?

I’m using ANTLR with Presto grammar in order to parse SQL queries. This is the definition of the string I’m using: However, when I have a query like this: it mess things up as it parses : ”’,’ as one string. When I used the following rule instead: I didn’t parse correctly q…

Load table from Oracle to MYSQL using python

Tried below code to load rows from Source(Oracle) to Target(MYSQL) Error Edited Updated Code_:- Error: Answer In Python, while all strive to adhere to PEP 249, no two DB-APIs are exactly the same especially in parameter implementation. Specifically, while the module, cxOracle, supports arbitrary placeholders …

Updating Multiple Columns in sqlite3

I am wanting to update multiple columns in my ‘Class’ Table in sqlite. I do not know how to do this so I approached the same syntax as an ‘INSERT’ query however, I seem to be having the following syntax error: sqlite3.OperationalError: near “VALUES”: syntax error The line I…

Selective summation of columns in a pandas dataframe

The COVID-19 tracking project (api described here) provides data on many aspects of the pandemic. Each row of the JSON is one day’s data for one state. As many people know, the pandemic is hitting different states differently — New York and its neighbors hardest first, with other states being hit …