I’m using Django with PostgreSQL as my Backend-Stack for an application of which the main feature is a complex, multilevel table displaying annotated time-series-data for different products. So …
Tag: python
How to count unique data occuring in multiple categorical columns from a pyspark dataframe
The Problem: In a ML based scenario, I am trying to see the occurrence of data from multiple columns in an Inference file versus the files that were provided to me for Training. I need this to be found only for categorical variables, since numerical attributes are scaled. The Expectation: I’ve got some success in doing the following in Standard
Linking two tables where the same value exists, without Primary key – SQLAlchemy
I have the following tables defined (very simplified version): I am using BigCommerce API and have multiple order_ids in both tables. The order_id is not unique globally but is unique per store. I am trying to work out how to link the two tables. I do have a Store table (shown below) that holds the store.id for each store, but
How can I return multiple rows in AsyncPG?
Let’s say I have a table with the following format: favoritefood favoritedrink pizza water ice cream orange juice pizza milk How would I return both rows with pizza as the favorite food with Python? I have fetchrow implemented for other functions, but it only works for one row, of course. Ideally, they would be sorted into dictionaries (ex: {favoritefood: pizza,
How do I update my stock database to reduce itself once a customer orders
Time to ask from the almighty stack overflow questions again. So my problem is that I am developing in TKINTER and have implemented and integrated 2 tables in one database on the application. I would …
Error in SQLite ‘all VALUES must have the same number of terms’
Glad to be a part of this platform among you, highly experienced programmers, Nowadays I am working on a POS system project in python, using tkinter for frontend & Sqlite as the database. While putting data into it, I am facing this issue. ”’ ”’ What I am trying to do here is retrieving data from the tkinter widget and
How do i write this in python and preferably in pandas?(Assume that i am dealing with a dataframe)
This is the code that i am trying to convert to Pandas: Assume the following column for input data frame: geo | region | sub region | txn_date | revenue | profit. Columns in output dataframe : geo | region | ytd_rev | py_ytd_rev| total_profit Answer I believe you need GroupBy.agg with named aggregation and new columns created in DataFrame.assign:
Passing parameters from Python to SQL Server
I have code like this: I am getting this error: ‘The SQL contains 1 parameter markers, but 2 parameters were supplied’, ‘HY000’ Is there any way to pass this parameter? I don’t want to create a dynamic array by concatenation. Is there any way to name the parameter marker inside the query in case of several where conditions? Answer If
SQLite – Combining Rows into New Columns
I am attempting to create a chatbot in Python 3.9 using my own text messages, but am having trouble formatting my data correctly. I have a table of text messages that looks like this: row_id Type Date Text 1 Incoming 2020-08-10 08:09:18 Hi 2 Outgoing 2020-08-10 08:11:04 Hello 3 Incoming 2020-08-10 08:11:12 For tomorrow 4 Incoming 2020-08-10 08:11:20 Are we
How to add placeholder in python for creating table name in mysql database?
here i want to name the table name according to user desire but i can’t please help ** I HAVE INCLUDED THIS CODES FOR CONNECTING PYTHON TO DATABASE ** Answer The syntax for creating a table in mySql looks like this: This will create the table named “my_table_name” with one column named “my_first_column” of type integer. To implement this in