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
354
questions
0
votes
0
answers
19
views
How to make python use more than 15 decimals in calculations?
In this question I made a claim that this construction of pentagons will always converge.
I drew the first 50 iteration using Geogebra here. However, zooming in on the 50th iteration resulted in ...
0
votes
0
answers
4
views
How can I effectively manage conversation history for dynamic question generation using Gemini AI?
I'm developing an AI application using Gemini for conducting conversational questions and answering. Currently, I'm storing conversation history in conversation_buffer throughout the session. However, ...
-1
votes
1
answer
10
views
How to use Params to set weight of optional property
I want to use FactoryBoy to create some fake data with an optional property. I want to be able to override the probability that the property is None.
0
votes
0
answers
7
views
Pandas overwriting every cell of dataframe with the same value when I try to filter it [duplicate]
EDIT: My question was immediately closed because it is apparently a duplicate of this one: How do I create a new column where the values are selected based on an existing column?
This question has ...
0
votes
0
answers
5
views
How can i "add" additional Data (Classification-Codes) to an existing Field
I have build a model which should representate our Products at work. Our products are different sorts of luminaires. Some of these with different variations like different colour-temperature, ...
1
vote
1
answer
20
views
Unexpected Behavior of pd.Grouper with datetime Key and freq Argument
Issue Description
When using pd.Grouper with a defined frequency for grouping dates in pandas, there is an unexpected behavior where dates that are expected to be grouped into the previous period ...
0
votes
0
answers
6
views
How Can I Load CSV File in PySpark by Matching Column Names with the Schema?
I am loading multiple CSV files using Python Spark. Below is the code:
spark.read.format("csv").option("header", 'true').schema(table_schema).load(file_path)
In this code, I am ...
-2
votes
1
answer
23
views
Problem with converting number to corresponding alphabet
My code is to take a string and reverse the number placement of each alphabet, a=27, z=1. so, a=z and b=y, encrypting the input in this pattern
input = input()
for character in input: number = ord(...
0
votes
0
answers
8
views
Python xlwings slow Execution when scanning Excel Sheet
I'm a beginner at Python.
This code is for scanning Excel cells by range using xlwings however the process is very slow.
I strictly need to use xlwings since it can retain my images and shapes unlike ...
0
votes
0
answers
8
views
Does coint from statsmodels.tsa.stattools in python consider stationarity?
At the base level I am trying to determine if two stocks are cointegrated. To that end I take the adjusted close data of two stocks and call coint on this data. However I am unsure if the coint test ...
0
votes
0
answers
7
views
Error in RAGAS: "embeddings must be set" when using answer_similarity in FastAPI
I'm developing a REST API using FastAPI, and I'm trying to calculate the similarity between answers using the RAGAS library. However, I encounter an error that says embeddings must be set.
Here's a ...
0
votes
0
answers
15
views
How can I copy part of a word file to another word file using Python
"My goal is to write a Python script that copies content between specific flags, such as {{START}} and {{END}}, from one Word file and pastes it into another Word file at a designated location. ...
0
votes
1
answer
13
views
How to add one variable part in dataframe name in pyspark?
Like i want to add today's date in dataframe name
df_2024_jul_05 = spark.table("tablename")
here the bold part is dynamic in nature
i tried the below code:
x = "df_"+str(date.today(...
0
votes
1
answer
20
views
How do I scrape a whole table when they all use the same class?, I can so far get the names only
I'm trying to get the data in the table labelled "Key rates". However, I can only extract the Names as they have a unique style ( ).
I want data from the table and arranged into a table by ...
0
votes
0
answers
20
views
Multiple files into single commit using PyGithub
I'm trying to add multiple files into a single commit using PyGithub.
I'm looping in my local directory to fetch all the files to be committed and then I'm trying to create a git blob for each.
Then I'...