2,204,197 questions
Score of 0
2 answers
51 views
How do I solve an error with a Python scraping program
I'm creating a program to collect news items from the internet regarding companies, separate out the text from the html code and then allocate scoring depending on the information it contains. I've ...
Score of 0
1 answer
50 views
When developing the same package for R and Python, do you put them in one github repo or separate repos
When developing the same package for R and Python, should I put them in one GitHub repo or separate repos?
What's making it a tad bit trickier is that the Python package is called
good_name, and the R ...
Score of -5
4 answers
368 views
Python script that copies certain lines and writes to other file [closed]
I want to write a .py function that copies any number that contains 5 as the second to last digit within one file, along with the line below it, then write it to a different file.
Trying something ...
Score of 2
2 answers
73 views
How to get both losses and detection predictions from Torchvision Faster R-CNN in training mode and vice versa?
I am using PyTorch's torchvision.models.detection.fasterrcnn_resnet50_fpn_v2 to train an object detection model.
By default, when I call the model in training mode, it returns a dictionary containing ...
Score of 2
1 answer
127 views
Does loadTable().to_pandas() transfer all data or only metadata first?
When using the Python API, I want to understand the data transfer behavior of loadTable vs to_pandas. The database table has millions of rows and I don't want to accidentally trigger a full transfer.
...
Score of -4
0 answers
122 views
How to accurately compute ballistic trajectory with quadratic drag and plot it in a fixed-size terminal grid in Python? [closed]
import math
# Constants
G = 9.81 # m/s^2
DRAG_COEFF = 0.005 # lumped drag factor: 0.5 * Cd * rho * A / m
DT = 0.05
def simulate_trajectory(v0: float, angle_deg: float):
theta = math.radians(...
Score of 1
2 answers
111 views
Nubra NubraDataSocket: code after keep_running() never executes, and option subscriptions return nothing
Two problems with the realtime feed:
socket = websocketdata.NubraDataSocket(client=nubra, on_market_data=on_tick,
on_connect=print, on_close=print, on_error=...
Score of -5
0 answers
154 views
Merge two Celery tasks
Let's say I have a web scraping pipeline. For some reason, I use Celery to write a sanitized payload to the database. The payload is a list for rows.
Due to the nature of the problem, two Celery tasks ...
Score of -6
0 answers
150 views
How can I preserve ID3 metadata when converting audio files to MP3 in Python? [closed]
I’m building a web-based audio processing application that converts audio files to MP3. The conversion itself works, but I’m having trouble preserving metadata such as the track title, artist, album, ...
Score of -3
0 answers
94 views
How to place a limit buy with an attached stop-loss and target in Nubra V3 (which executionMode?) [closed]
In Zerodha I'd place a separate SL-M order after the entry fills. Nubra's V3 payload seems to let me attach exits to the entry, but I'm confused by executionMode (ENTRY, EXIT, ENTRY_AND_EXIT) and the ...
Score of -7
0 answers
87 views
Does type-checking have any runtime overhead? [duplicate]
At the moment I am excluding all the type-checking imports from runtime as code below but now wondering if this is necessary and whether these actually get compiled into the .pyc and used at runtime ...
Score of 0
0 answers
86 views
User Application doesn't start on the RFID Reader Zebra FX7500
I have a Zebra reader and I want to use with my user application. I created a Python script. I use this help/manual: https://zebradevs.github.io/rfid-ziotc-docs/
I fixed errors in the original Zebra ...
Score of -10
0 answers
113 views
How to request JSON data from NYT, BLS, Census, and NewsAPI using Python requests? [closed]
Question
I am practicing how to retrieve JSON data from several public APIs using Python.
I currently have API keys for:
New York Times Article Search API
U.S. Bureau of Labor Statistics (BLS) API
...
Score of -9
0 answers
140 views
CS50s finance - stuck at : buy handles valid purchase [closed]
Cause
expected to find "112.00" in page, but it wasn't found
Log
sending POST request to /login
sending POST request to /buy
sending POST request to /buy
checking that "112.00&...
Score of 3
1 answer
117 views
Creating a IntegrityError for testing purposes
For testing purposes and building my own understanding, I'd like to create a simple Django model and form that can result in a django.db.utils.IntegrityError when saved. Ideally, the error would be ...
