Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
1 vote
1 answer
137 views

I created these database tables with the inspiration in NjDevPro github repository. The design uses Closure Table for implementation of hierarchical tagging system in ...
xralf's user avatar
  • 37
3 votes
2 answers
337 views

How does the following look for a json lexer? Are there any things that can be improved upon? Does the pattern look general-purpose enough to be able to generalize it to make it into a useful program, ...
David542's user avatar
  • 479
1 vote
1 answer
2k views

As you can see I am using a counter variable to iterate through my JSON file and it's a dictionary that has a list of dictionaries. Once I find the key normalHours I divide it and add it to my ...
JThao's user avatar
  • 57
1 vote
1 answer
190 views

Recently I have been learning Python after years of putting it off, and I am having a really fun time with it. However after I spent a few hours making something that I thought was pretty cool, I ...
Evil2's user avatar
  • 11
1 vote
1 answer
231 views

I have a Python 2.7 script that loops through GIS polylines and updates a coordinate. The coordinate is called an "M" coordinate (aka a "Measure-value"). M coordinates are similar ...
User1974's user avatar
  • 218
1 vote
1 answer
102 views

I am trying to remove files in my directory if they are over 30 days. However, I don't know what other checks I need to do. The examples I found online weren't very thorough besides just subtracting ...
JThao's user avatar
  • 57
1 vote
1 answer
3k views

So I need to update my nested dictionary where the key is "compensationsDeltaEmployee". I created a string cost_perhour to hold the value of my conditional statements. Now that I am done ...
JThao's user avatar
  • 57
1 vote
2 answers
1k views

I have a dictionary that I am writing to a csv file, however I am only writing the values. I want to know if there is a faster way than using a for loop. I am using python 2.7 here is my code. ...
JThao's user avatar
  • 57
3 votes
4 answers
2k views

Coming from another language than Python, I would like to see if my code is "pythonic" enough and follows good practices. It compares two directories, showing all files that are in one and ...
Saya's user avatar
  • 137
8 votes
3 answers
3k views

I am trying to create a code for the Basic evapotranspiration equation by Hargreaves. I have attached a screenshot of the equation to be replicated. I want to create a class wherein I can input data ...
jeronimo dcosta's user avatar
5 votes
1 answer
1k views

The below class implementing a simple way to create emails with attachments, including the option to create in-memory zip files and attach them to the email. Because I am not a professional programmer ...
Alex's user avatar
  • 151
8 votes
2 answers
3k views

I am new to python, and developing a moderate application for which I need to setup a logging mechanism. The below program sets up log handling, which gives the user an option to specify whether log ...
Cheppy's user avatar
  • 83
3 votes
1 answer
79 views

As a side project, I'm working on a Bokeh web application to display public bikeshare data on a map. The data is updated every 2 minutes using a periodic callback. Below is the full implementation. I'...
keves1's user avatar
  • 31
3 votes
0 answers
89 views

I am using a function that returns a list of all files (full path for each of them) with the given extension in the given folder and all subfolders. As the process is quite long and user can get ...
SlavaB's user avatar
  • 31
2 votes
3 answers
704 views

def T(n): if n <= 0: return 1 else: return T(n-1) + (n-1) * T(n-2) print T(4) I need an effective way to print out the output of the function <...
Justin's user avatar
  • 2,619
4 votes
0 answers
311 views

I'm new to both Python and socket programming and figured setting up a simple chat server would be good practice. In addition to general critiques of the code, I have specific questions: What are the ...
JeremiahDixon's user avatar
5 votes
4 answers
1k views

Background I am currently participating in a tic-tac-toe coding challenge. During their move, each participant is given the board state and their team, X or O. The blank board is: ...
DapperDuck's user avatar
3 votes
1 answer
102 views

I have rows in a database table with a hierarchypath column. The values in the column are hierarchy paths with up to four levels: ...
User1974's user avatar
  • 218
1 vote
2 answers
848 views

I have written this regex to validate an email. It seems to work fine. Can someone advise on the regex used? Does it work properly or can be done in a better way? ...
gss's user avatar
  • 169
3 votes
1 answer
897 views

Using only Python 2.7 and the standard library (no imports): Determine if a point is inside the rotated rectangle. ...
User1974's user avatar
  • 218
12 votes
3 answers
2k views

I’ve created a function that takes a number and, if it’s prime, tells you so, or if it’s composite, gives you the prime factors of the number (and if it’s 1, tells you that it’s neither). ...
Fivesideddice's user avatar
2 votes
1 answer
203 views

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you! Problem Two strings X and Y are similar if we can swap two letters (in different positions) of X, so that ...
Emma Marcier's user avatar
  • 3,742
2 votes
0 answers
164 views

I will describe two techniques, then the question will be how I can make an algorithm that is more efficient, if possible. I want to find an efficient way to determine the squares where the pieces on ...
3sm1r's user avatar
  • 143
2 votes
1 answer
143 views

This script was previously reviewed here: Part 1: Create or update record via HTTP request I've made the changes that were suggested by @Reinderien. Now that the code has been significantly refactored,...
User1974's user avatar
  • 218
5 votes
1 answer
422 views

Update: This is an older version of the question/script. The new version can be found here: Part 2: Create or update record via HTTP request I have an external system that sends an HTTP request to a ...
User1974's user avatar
  • 218
2 votes
1 answer
111 views

I am using a dictionary to save possible trajectories in a game. A trajectory is defined as a list of numbers separated by _. For example ...
3sm1r's user avatar
  • 143
2 votes
1 answer
176 views

I'm fairly new to Python but had to start using it and for reasons I have to use 2.7, which is why I am using that syntax. I have this function which gets data from a file, if it exists, and then gets ...
SimonT's user avatar
  • 173
0 votes
1 answer
565 views

I was just wondering if there is a way to speed up the performances of this for loops in Python. I'm trying to process an image to get the color-moments without using libraries. It takes about 12sec ...
Enrico Mosca's user avatar
6 votes
3 answers
1k views

I wrote a simple prime sieve in Python. But it ended up looking... ugly. I included a few of the most basic optimizations. When posting this question SE suggested a bunch of questions on the same ...
martixy's user avatar
  • 253
1 vote
1 answer
66 views

Can this function simplified? The goal is return one key from each dictionary (both contain the identical keys), so that the sum of the values that belong to the selected keys are minimal (and also ...
user3680510's user avatar
2 votes
1 answer
419 views

I have created the below code which works for me, but I feel there might be a better way to accomplish this in a new Pythonic way or better Python syntactic way. Code snippet: ...
Karn Kumar's user avatar
0 votes
1 answer
6k views

The challenge is to find the maximum product of a subset of a given array. Here's the problem: Write a function solution(xs) that takes a list of integers representing the power output levels of ...
Daniel Bertoldi's user avatar
3 votes
1 answer
321 views

I'm attempting to speed up some python code that is supposed to automatically pick the minimum samples argument in DBSCAN. Currently the execution time grows exponentially as the number of training ...
random_dsp_guy's user avatar
2 votes
2 answers
215 views

I have written a python 2 program for a school project to convert from hexadecimal to decimal without using built-in functions and vice versa in python. I would like to know how I can make my code ...
myang0630's user avatar
  • 564
4 votes
1 answer
361 views

I have to apply two deals on the cart. Buy 3 (equal) items and pay for 2 Buy 3 (in a set of items) and the cheapest is free Items in cart: ...
Ciasto piekarz's user avatar
1 vote
1 answer
239 views

I have developed this script to read employee_language table records of a PostgreSQL database using Python 2 (due to some OS limitation). I want to find duplicate ...
Ibrahim Rahimi's user avatar
2 votes
1 answer
65 views

I have an Oracle GIS database that has spatial tables. The records in the spatial tables have a geometry column that contains polylines. I've written a Python 2.7.16 script that calculates the ...
User1974's user avatar
  • 218
6 votes
1 answer
206 views

I have created a wrapper for displaying messages with ArcPy and IDLE (as that is all I have available to myself due to certain circumstances) as I frequently use both to test and develop new tools. ...
user avatar
1 vote
1 answer
97 views

Can anyone advise on how to use the SymPy TensorProduct function without having to explicitly indicate the full sequence of objects to take the product of. Below (for the simple case N=3) you can see ...
John Doe's user avatar
  • 113
2 votes
1 answer
336 views

I have this code to weave the split_input ['5,4 4,5 8,7', '6,3 3,2 9,6 4,3', '7,6', '9,8', '5,5 7,8 6,5 6,4'] together. However I feel like this can be done more ...
Nick's user avatar
  • 21
0 votes
1 answer
154 views

I have a code for a short Python 2 Pig Latin translator. Is it a good code, or should it be revised? ...
Hunter's user avatar
  • 11
5 votes
1 answer
234 views

What's up smart people. A little backstory for context: I'm a completely self taught dev, and the only person ever looking at my code for the past 6 years is myself. I realize that's not the best idea ...
FallenSpaces's user avatar
3 votes
1 answer
744 views

Simulate a tic-tac-toe game Requirements A player is picked at random as a first player. The two players plays tic tac toe game. The game ends when the board is full or either one of the player ...
Akanksha's user avatar
  • 129
6 votes
1 answer
245 views

Below there is a function eating all strings and convert it to Unicode. It works fine. But is it the best way to do so? Is there maybe already an existing function for it? The reason was a German ...
Cutton Eye's user avatar
2 votes
1 answer
499 views

Preliminary I need to read a binary file constructed by writing a Struct to it with Python. So I decided to write a simple wrapper using ...
LRDPRDX's user avatar
  • 941
1 vote
3 answers
94 views

I've implemented C++'s std::includes algorithm in Python, so that I can use it to efficiently implement a Scrabble "can I make this word" function: ...
Quuxplusone's user avatar
  • 19.7k
4 votes
2 answers
384 views

I started to learn Python not long ago to automate certain tasks I work on. I want to optimize a script I wrote that takes a line in an Excel file and prints a pattern of text based on this line's ...
pythonoob's user avatar
1 vote
1 answer
281 views

My page (even when it has no data) takes 10+ seconds to load. That's just too long, considering when you finally get to it there's no data. When it has data, it takes even longer. Here is my view, ...
Helana Brock's user avatar
5 votes
2 answers
321 views

I'm an intern and have an ETL project I'm doing in python. Part of it is to make sure after I move files I delete empty directories. I wrote this code to clean up directories that are empty and in ...
lc74's user avatar
  • 51

1
2 3 4 5
25