Questions tagged [python-3.x]

Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008. Use this tag along with the main python tag to denote programs that are meant to be run on a Python 3 interpreter only. Do not mix this tag with the python-2.x tag.

548 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
39 views

Cameleonica: key value store

This code is part of project Cameleonica. It is a key value store, a simple nosql file based database. This code requires an atomic ordered filesystem which means ...
1
vote
0answers
937 views

Unit tests for a Redshift wrapper class

I'm somewhat new to TDD and unit testing, but I've written a suite of unit tests to check my functionality. The basic classes automate simple load and unload operations from s3 and redshift, and ...
1
vote
0answers
2k views

Email a notification when detecting changes on a website - follow-up

I read through other questions here and improved the code and added a new feature. The old question can be found at: Email a notification when detecting changes on a website The improvements that are ...
1
vote
1answer
5k views

Created a frame with a disabled button, till check button is used, then return to starting state

I've been coding Python for little over 6 months now. I am self taught and I would like to ask for some help for myself and also for others in my position who's been wondering if they're going about ...
1
vote
0answers
272 views

Flask json rpc2.0 extension

I created a simple extension to handle JSON RPC 2.0 requests on flask I would like some feedback regarding usage here is an usage example: ...
1
vote
0answers
317 views

Optimal use of Python 3's multiprocessing package to create Sudoku grids

I want to create Sudoku grids using Python. As it's pretty slow if I want to create a bunch of grids, I decided to use multiprocessing. My computer has 4 virtual ...
1
vote
0answers
70 views

Parsing span library

This is a Python library for efficiently tracking span information while parsing source code, and generating errors on those spans. I intend to use it in my rewrite of mypy's Python parser to add ...
1
vote
1answer
41 views

Integer field in Python with extra constraints (Testable class)

I am trying to write an integer field in Python with the following attributes: Minimum Exclusive minimum Maximum Exclusive maximum Multiple of Value Basically, given the constraints and the value, ...
1
vote
1answer
108 views

Merge Sort Cleanup

I am re-learning my fundamental algorithms, and have been told my Python is overly verbose. Can you take a look at my merge sort algorithm and let me know how you would clean it up and make it more ...
0
votes
0answers
15 views

Python script to replace GitHub password with tokens

I manage a fleet of IoT devices. As for now, GitHub announced that the username-password authentication would be deprecative soon, so I have to change the password on each device to the GitHub access ...
0
votes
0answers
15 views

Logistic regression using Sklearn in Python

I'm trying to learn how to use logistic regression with Sklearn. After learning the theory, I tried implementing it using the Heart Attack Analysis datasheet from Kaggle. Here's a snippet of the data: ...
0
votes
0answers
17 views

User input, floats, ints and ranges

Intro So I am writing a larger script where a part of it is checking user input. Maybe I have a menu where the user can choose different options, or maybe I want them to write in some number/s. After ...
0
votes
0answers
26 views

How to most efficiently make repeated calls to API with Pandas/Python

Looking for some help on how to speed up the code below as I'm still relatively new to using Pandas. The playoff_stats function makes thousands of calls to the PlayerCareerStats API - and while it ...
0
votes
0answers
26 views

Plotting 2 types of data from DataFrame with different colors

This is the task: ...
0
votes
0answers
35 views

Using python classes to classify database records

I have a database, with tens of thousands of records, which I wish to represent in python. The python 2.x version has tables in which each record is an instance of a class and the values in the record ...
0
votes
0answers
71 views

Python Classes for Robot Test Framework which Open Paramiko SSH Connections and Run Commands

Background I am writing a custom library whose keywords can be used with Robot Framework to verify configuration files, check running processes, and eventually other things tailored to a project I ...
0
votes
0answers
38 views

Stop Django Rest Framework API execution and return appropriate response

I am writing an API function using Django Rest Framework where it accesses many resources like AWS, Database, External APIs etc., I want the API execution to stop if it fails in any of the steps and ...
0
votes
0answers
19 views

Stacking Classifier Implementation

I was going through the book Hands on Machine Learning With Scikit-Learn & Tensorflow. In one of the chapters, the author mentioned ...
0
votes
0answers
60 views

Handling exceptions

I had a blast to get a awesome code reviewer yesterday who taught me very much and I do hope I have done a pretty good job on improving my knowledge both with exceptions and in general. Currently I ...
0
votes
0answers
28 views

Return screenshot data from subprocess without residual files

I have a use case, where I want to take screenshots via scrot without leaving behind residual files: ...
0
votes
0answers
11 views

Filter string depending on filtered & unfiltered keywords

I have worked on a small script where I check if the given string is a filtered or unfiltered keyword. Basically if its filtered then we want to add a additional key to dict. with value True, if its ...
0
votes
0answers
16 views

Markov Chain Monte Carlo (MCMC) wind simulate

I want to generate wind data with the use of MCMC. The results I am getting are quite off from the measured mean values not sure why. SIMULATE WIND DATA ...
0
votes
0answers
25 views

Three Sum Algorithm

I made a randomized algorithm to solve the three sum problem. There are two key parameters: number of solutions, and total. Notably, the algorithm might generate a duplicate solution. This is not ...
0
votes
0answers
14 views

Scikit-learn SVR stock prediction

I am messing around with the sklearn ML library to see if i can "predict" stocks with it, currently when it takes all the datapoints i have, it "predicts" it but i am trying to get ...
0
votes
0answers
20 views

Organization of work with MongoDB in Flask

I`m trying to make an API for Flask together with MongoDB, before that I used the SQL DB using SQLAlchemy and there I used models for organizing the database. Now I'm a bit confused how to organize ...
0
votes
0answers
21 views

How to write a dictionnary of object instances describing geometrical shapes

My current position implies a lot of programming but I lack formal knowledge concerning how to properly code, and this is the object of my question. I believe the form of my code could be improved. As ...
0
votes
0answers
23 views

Bar chart - can we simplify?

I have a dataframe: ...
0
votes
0answers
54 views

Is there a better way to calculate joint probability?

After a long struggle, I've completed the Heredity project of "CS50's Introduction to Artificial Intelligence". However, I feel like my solution was not the most dignified way of doing it. ...
0
votes
0answers
24 views

Python Stack Datastructure

I attempted to implement a stack based on functional programming. Specifically, the idea is to allow structural sharing to reduce space usage. To do structural sharing, I added a unique key for the ...
0
votes
0answers
64 views

Proper Python type-annotation for variable parameters signature of inherited method overloads

I have a CLI lib to automate batch operations on GitHub with many use cases: create issue, merge PR, delete branch... Since they all operate in a similar fashing regarding execution and output, I ...
0
votes
1answer
22 views

Forming a dynamic dictionary based on searched key and values pair using RAW logic and not modules of python

I am trying to create a dictionary with a file containing text based on a matched pattern. Lines containing key_str should become keys and subsequent lines not matching key_str should become values ...
0
votes
0answers
28 views

Reduce computing time of planning method (grid)

Has anyone an idea how to change the planning(self, sx, sy, gx, gy)-method to save computing time? I'm new to NumPy and don't know how to use it effectively yet, but I heard it could also be a good ...
0
votes
0answers
22 views
0
votes
0answers
21 views

Optimized method of transfering numpy image arrays over localhost to web-tech UI for desktop UI

I have been doing testing to find the most efficient way to display numpy array images to a HTML, CSS, JS UI (specifically, with CEF Python). I mainly used the method explained here to do the numpy ...
0
votes
0answers
34 views

Save a dynamically created DAG in Airflow instead of registering it to the scheduler

I would like to save my dynamic DAGs and not have them autoscheduled by the Airflow scheduler and so I an not using the globals() utility. Is this the right way? I saw pickling_dag but doesn't seem ...
0
votes
0answers
38 views

Randomized Algorithm for finding optimal path in graph

Note: the optimal path can be chosen as the shortest path or the longest path I made a randomized algorithm for finding random paths in a graph. The graph has weights on the edges. For non-cyclic ...
0
votes
0answers
48 views

Convert hex to base64 and then fixed XOR

I've seen on the site questions where too simple tasks can be grouped into one. Here are Challenge 1 & 2 from Crypto Challenge Set 1 in Python. Any suggestions? ...
0
votes
0answers
125 views

Convert JPG to H5 and plot the images

I'm learning ML/DL and found the process of getting the data and labels quite tedious. There is not much details on how to get JPG files into H5, which is (afaik) the only way to work smoothly later ...
0
votes
0answers
96 views

Resize video frame to fit tkinter window size when the window is resized

I've written a piece of code to play a video using OpenCV on tkinter. Its part of a game I've made and compiled into an application. But I've noticed that when I play the game in a different computers,...
0
votes
0answers
15 views

Create map query for each unique value in column

I have a Python 3.6.8 script that does the following: Takes the unique values in a column in a spatial table. Creates map queries/layers for each unique value. Each query/layer has a where clause ...
0
votes
0answers
48 views

Translate keyboard inputs to corresponding actions in pyautogui

I'm working on a multiplatform open source clone of tinytask, specifically on the play/stop feature. Now, it looks like: ...
0
votes
0answers
352 views

Python script to import MySQL tables to PostgreSQL

I'm using the below Python script to port few table data from a remote server (MySQL database) to my data warehouse server (PostgreSQL DB), The script is working fine (I'm using foreign data wrapper), ...
0
votes
0answers
72 views

Shopping list sent by email using Python 3

This script sends the user's shopping list to the recipient's email address. Maybe you can help me correct some mistakes. ...
0
votes
0answers
3k views

Tic Tac Toe game in Python 3.X using tkinter GUI version 2

I am completely new to programming and to python and as my first self-learning project I am creating a simple Tic-Tac-Toe game. I have already posted a version of my code here on stack: Tic Tac Toe ...
0
votes
0answers
55 views

Nested cross-validation

This is a homework assignment to implement nested cross validation. It seems to work fine (sometimes). The imports are inside the class and some methods are static, because this code needs to be in ...
-1
votes
1answer
81 views

Finding longest word in a sentence

A problem from Coderbyte. Find the longest word in a sentence after removing the punctuations and if two or more words are of same length return the first word Below is my solution: ...
-3
votes
1answer
72 views

Project Euler #5 Optimized

I have seen multiple questions on this problem but none seem to answer my specific question. To start, the basic question is asking to find the smallest number that is divisible by numbers 1 to 20. ...
-3
votes
1answer
43 views

Printing the steps of a function composition

I have this code: ...

1
7 8 9 10
11