Questions tagged [python]

Python is a multi-paradigm, dynamically typed, multi-purpose programming language. It is designed to be quick to learn, understand, and use, and enforces a clean and uniform syntax. Please note that Python 2 is officially out of support as of 2020-01-01. For version-specific Python questions, add the [python-2.7] or [python-3.x] tag. When using a Python variant (e.g. Jython, PyPy) or library (e.g. Pandas, NumPy), please include it in the tags.

1,975,017 questions
0votes
0answers
5views

Pyspark: parse json column then add new column in the same dataframe with parsed value

Here is an example of what im trying to accomplish: case: column1 column2 json_column One Two {'A': '1', 'B': '2', 'C': '3'} desired output: column1 column2 json_column B One Two {'A': '1', 'B': '...
0votes
0answers
9views

TypeError: a bytes-like object is required, not 'str' for ListType[array(float32, 2d, C)]

I would like to export these embedding into a .csv file - fig, axs = plt.subplots(10,11, figsize=(20, 20)) ax_bound = axis_bounds(np.vstack(updating_mapper.embeddings_)) for i, ax in enumerate(axs....
0votes
0answers
8views

Seeking help on how to use a real time API to trigger a tweet from a Twitter bot

I've been learning Python for the last 6 months, and am finally working on a project. As a huge NY Mets and Twitter fan, I thought it would be fun to create a Twitter bot that tweets whenever a play ...
-1votes
0answers
12views

Dataframe calculations in pandas python

I have this dataset (df): TIMESTEP id radius x y vx vy Area 0 42 0.490244 -3.85683 0.489375 0.0 0.0 0.7550478008000959 0 245 0.479994 -2.88838 0.479446 0.0 ...
0votes
0answers
8views

Spark dataframe inside loop taking slower each time

I'm new to Spark and it seems like I'm figuring out the right way to iterate over a dataframe multiple times. I'm trying to loop over a spark dataframe 10 times, each time for a different date to get ...
0votes
1answer
11views

I can't append a form answer to a list in Python

I'm working on a chat web app using Flask. I was thinking I'd display user messages by appending them to a list, but for some reason it won't work. It appears to be having trouble with the form ...
0votes
0answers
10views

Discord.py - Buttons side by side

I've created some buttons for my Discord bot. The buttons now show up underneath each other while I'd rather have them side-by-side instead. I tried using an ActionRow for this, but that doesn't seem ...
0votes
0answers
8views

Scrollbar added to the frame by using canvas doesnt work properly, just scrolls a little bit (tkinter)

my scrollbar doesnt work properly. it just scrolls a little bit. The logic in here is that the worker will select a machine name and than select how many different parts will be used in that machine. ...
-1votes
1answer
24views

Multiple conditions for printing arrays in Python

I have an array A with shape (3,3,3). I want to print A[0], A[1], A[2] only when at least one of the elements of A[0], A[1], A[2] is <=10 or>=30. But I am getting an error. The expected output ...
0votes
0answers
13views

Vibration sensor

I want to detect if an object is vibrating or not by using the data from a sensor. The sensor sends 1 whenever it detects a vibration. So I want to use this data with a raspberry pi to detect a ...
0votes
0answers
10views

How to add specific integer in the output text after certain period of time?

enter code here user_will = input("enter the name ") if user_will =="giant": remainder = (10 - 4) print("the remaining are", remainder ) I want to add 1 in ...
0votes
1answer
13views

Multiple date conversions in Pandas

I have a dataframe that contains multiple rows such as the following examples, with two separate object (string) columns such as the following: Date Time 18 Jun 2022 10:22 18 Jun 2022 10:03 ...
0votes
0answers
8views

Web scraping with Discord.py not responding the command

I'm making a Discord bot using BeautifulSoup that gets some information in a link and send it in embed. Here's the code: @bot.event async def on_message(message): if message.content.lower =='!...
-1votes
0answers
19views

How to create an "Open with..." script in python [closed]

I was wondering if there is a way to create a script that would do the same thing as right-clicking on a file and opening it with a specific program. I am trying to convert a .dlg.gz file to a .dlg ...
0votes
0answers
8views

How to display POST value id's in their unabbreviated format in Amazon SES email using Python

I have created a web form that is submitted using POST method, and the data is stored in a DynamoDB table. The value of the package id is abbreviated for more efficient storage in DynamoDB. For ...

153050per page