For example, Or Assume that I have a limited (max 5) number of descriptions. Which approach is better and would be considered as good practice? Answer I am generally in favour of multiple models rather than using JSON, though there is still a time and a place for the JSON field. You have a number of descripti…
Tag: python
Why can’t I access tkinter objects after importing tkinter as something?
I’m following a simple tutorial, learning about the tkinter library. In the tutorial, they do this: I was told the above is not good practice so instead I did: However, later on in the code I have to do something like this: This gives me an error because I didn’t import ttk as its own module. I wo…
In Jupyter notebooks, how to connect to MS SQL with a different Windows user
I have Select access to a MS SQL database that I would like to extract data into a Pandas dataframe running inside a Jupyter notebook. For reasons out of my control, I have access to the database from a different user. How can I query the database from Jupyter while connected to my current user account? Answe…
Python Regex: multiple regrex causing problem
A basic version of this problem is using an regex to translate something like abc like ‘%FFddsdE%’ into LOWER(abc) like ‘%ffddsde%’ and the following code works well However, everything crash down if we want to expand this problem a little bit, to both like and not like It gives LOWER(…
Creating another column in pandas based on a pre-existing column
I have a third column in my data frame where I want to be able to create a fourth column that looks almost the same, except it has no double quotes and there is a ‘user/’ prefix before each ID in the list. Also, sometimes it is just a single ID vs. list of IDs (as shown in example DF).
Update column based on grouped date values
Edited/reposted with correct sample output. I have a dataframe that looks like the following: This dataframe is split into groups by ID. I would like to make an updated combined column based on if df[‘bool’] == True, but only if df[‘bool’] == True AND there is another ‘finished&#…
In python pandas, How do you eliminate rows of data that fail to meet a condition of grouped data?
I have a data set that contains hourly data of marketing campaigns. There are several campaigns and not all of them are active during the 24 hours of the day. My goal is to eliminate all rows of active hour campaigns where I don’t have the 24 data rows of a single day. The raw data contains a lot of
Creating scatterplot / regression line using python
I am stuck on this problem but cannot figure out why it isn’t working as intended. I have a text file with a bunch of x and y coordinates which I need to use to find the average of all x and y values in order to calculate the slope for my regression line. It seems like stamping the individual
What is the matplotlib equivalent of MATLAB Figure.Position?
I am working on converting some MATLAB plotting code to Python / matplotlib. The original MATLAB code contains this: I am trying to determine the matplotlib equivalent of the assignment to F.Position. MATLAB docs describe this property as conveying the location and size of the drawable area, but matplotlib.fi…
How do I now (since June 2022) send an email via Gmail using a Python script?
I had a Python script which did this. I had to enable something in the Gmail account. For maybe 3 years the script then ran like this: In May or so of this year I got a message from Google saying that authority to use emails from scripts would be tightened. “Oh dear”, I thought. Some time in June …