Questions tagged [python]
Python is a dynamically typed, multi-purpose programming language. It is designed to be quick to learn, understand, and use, and enforces a clean and uniform syntax. Note that Python 2 reached end-of-life on January 1st, 2020. For version-specific Python questions, add the version tag (e.g. [python-3.x] or [python-3.9]). When using a Python variant (e.g. Jython, PyPy) or library (e.g. Pandas, NumPy), please include it in the tags.
python
15
questions with bounties
0
votes
2
answers
88
views
+50
Working outside of request context in the FastAPI application unit testing
While converting Flask application to FastAPI, I got following error in unit tests:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/python/3.11.7/lib/...
1
vote
1
answer
44
views
+50
AttributeError: xlColumnClustered
My Python code to generate charts from pywin32 in Excel is:
def add_chart1(location, sheet, range1, title, left, right, height, width, charttype):
pythoncom.CoInitialize()
xl = win32.gencache....
1
vote
1
answer
118
views
+50
Why does flask seem to require a redirect after POST?
I have an array of forms I want rendered in a flask blueprint called fans. I am using sqlalchemy to SQLLite during dev to persist the data and flask-wtforms to render. The issue appears to be with ...
0
votes
1
answer
59
views
+100
How to choose dataset_text_field in SFTTrainer hugging face for my LLM model
Note: Newbie to LLM's
Background of my problem
I am trying to train a LLM using LLama3 on stackoverflow c langauge dataset.
LLm - meta-llama/Meta-Llama-3-8B
Dataset - Mxode/StackOverflow-QA-C-Language-...
0
votes
0
answers
69
views
+200
How do I rotate or translate an object at the mouse position in a vtk environment?
I would like to rotate or translate an object that look like a cylinder by pressing the left button of the mouse on it.
to rotate, i would like to click on the tip and make it rotate around the other ...
0
votes
1
answer
57
views
+50
Cloud - Read from Local Network File Storage (e.g. via Azure Function)
I am looking to use python code deployed in Azure Cloud (e.g. on an Azure Function), to read files location from a shared/local network drive (on-premise). The network drive requires user based ...
0
votes
1
answer
87
views
+50
pcolormesh and memory use after adding to plot
If I have code like this :
import matplotlib.pyplot as plt
import numpy as np
time_axis = np.arange(0, 30 + 1 / 50, 1 / 50)
another_axis = np.arange(0, 10, 1)
grid = np.zeros((len(another_axis), len(...
2
votes
3
answers
125
views
+50
Pandas read XML file with designated data type
My code:
df = pd.read_xml(
path_or_buffer=PATH,
xpath="//Data",
compression="gzip"
)
I'm using Pandas read_xml() function to read xml.gz format data. I'm using Pandas ...
0
votes
0
answers
32
views
+50
Training a Custom Feature Extractor in Stable Baselines3 Starting from Pre-trained Weights?
I am using the following custom feature extractor for my StableBaselines3 model:
import torch.nn as nn
from stable_baselines3 import PPO
class Encoder(nn.Module):
def __init__(self, input_dim, ...
1
vote
0
answers
76
views
+50
Multivariate normal distribution using python scipy stats and integrate nquad
Let $X_1,\cdots, X_n$ be independent normal random variables with means $\theta_1,\cdots,\theta_n$ and unit variances, i.e. $X_i \sim N(\theta_i,1)$ for $i=1,\cdots, n$.
I would like to compute the ...
1
vote
0
answers
36
views
+50
SAM build can't resolve dependencies for 'onnxruntime'
My problem
Summary
I am trying to implement YOLO on AWS Lambda, and when trying to build a Lambda Layer with ONNX, I get Error: PythonPipBuilder:ResolveDependencies - {onnxruntime==1.18.1(wheel)}.
...
3
votes
1
answer
66
views
+100
How do I add a location filter when using the LinkedIn Voyager API?
I'm trying to scrape LinkedIn job postings using the Voyager API, adapting code from here. Here's the relevant portion of the code:
class JobSearchRetriever:
def __init__(self):
self....
2
votes
0
answers
103
views
+50
Why removes Bokeh hours from DateTimeTIckFormatter after some seconds
I'm building a line chart using bokeh.
In X axis I m plotting datetime values. I have also create a DateTimeTickFormatter to display label of this axis:
DateTimeTickFormatter is this:
...
1
vote
0
answers
69
views
+500
Why am I getting a blank page when deploying a Holoviews app through Heroku with panel serve?
I have connected my github repo to Heroku and am using that to deploy a file called main.py from my main branch. The code in main.py is as follows
# In[29]:
# In[30]:
import pandas as pd
import ...
3
votes
1
answer
55
views
+50
PyTorch Model Performs Poorly in Flask Server Compared to Local Execution
I have a PyTorch model that generates images with high quality and speed when I run it locally. However, when I deploy the same code in a Flask server, the generated images are of much lower quality ...