Category "python"

Apply function to multiple row pandas

Suppose I have a dataframe like this 0 5 10 15 20 25 ... action_0_Q0 0.299098 0.093973 0.761735 0.0

How to get this single column data into data frame with appropriate columns

I am learning pandas and Data Science and am a beginner. I have a data as following Rahul 1 2 5 Suresh 4 2 1 Dharm 1 3 4 I would like it in my dataframe as Rah

Django for loop in Carousel

I'm trying to add a title to each slide in a dynamic carousel in Django. I have the images functioning properly and working as expected. The title is stacking o

How to solve 'str' object has no attribute 'lemma_' using Spacy?

I tried to do a lemmatization for my DataFrame using Spacy in python. The code that I used is like this below: # import spaCy's language model nlp = spacy.load(

How to break for loop at the end of a line

Task at hand here is to create a dictionary using specified inputs. First element is key and following elements are values. Input: name, George Mason pa, 100.0,

How to read a text file into a list or an array with Python

I am trying to read the lines of a text file into a list or array in python. I just need to be able to individually access any item in the list or array after

Converting Images to ASCII art using Python & Python Imaging Library

I'm currently trying to write a program that converts images into ASCII art in Python using Python Image Library Here's what I got so far: import PIL.Image # a

"ValueError: 'image_path \tpredicted_labels \tconfidence score' is not in list"

Getting this error when I run the following code in google colab "ValueError: 'image_path \tpredicted_labels \tconfidence score' is not in

How can I group by below table from Customer ID and Product Code and get them to one row?

How can I group by below table from Customer ID and Product Code and get them to one row as below using Python? Customer ID Product Code Days since the last

Python 3.10 Type Hinting causes Syntax Error

I have defined two classes. A Bookshelf class and a Book class and have defined each with its own methods and type hints. When I run the below code in VS Code u

Call Python file with main method inside Jupyter notebook

I have a problem. I want to call inside my Jupyter Notebook a Python File. I looked at How to execute a * .PY file from a * .IPYNB file on the Jupyter notebook?

Python - Division by zero

how can i make something divided by 0 equal base, EX: 5/0 output 5 Sorry I can't explain properly, I'm new to programming

Python OpenCV putText() show (non-ascii, unicode, utf) character symbols

I am creating a sign language detection application in Armenian. However, the Armenian letters don't show when I am signing but do show in my console/terminal.

Plot points in google map with python with google api

I'm trying to plot some points on a map, and when searching on the internet, I found [this][1] tutorial with Google Maps and Bokeh library. The problem is that,

Unable to install turtle module

Collecting turtle Using cached turtle-0.0.2.tar.gz (11 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python

Crashing Jupyter Notebook

enter image description here enter image description here enter image description here enter image description here enter image description here enter image des

extract emotions from text in dataframe in senticnet

I am very novice in python and I treat to extract emotions from sentence in datafram though senticNet this my code but its not correct I don't know what's the

Transportation Problem : how to addresing variable from range(len()) for constraint? (transitioning from excel)

I'm new on using phyton for optimization (usually I simple use Ms.Excel) and this is my first time asking on stackoverflow. Usually in Ms. Excel you can add con

PyPDF2.extractText( ) extracts text but tokenizes strings when pdfs contain watermark

I am using PyPDF2 to read multiple files and extract the page number that contain specific text. For the most part it works fine but I notice that some files wi

Get rid of single quotes from the substituted string within sed command in Python

I have a text file 1.txt which has following content: module abc I am trying to generate multi-line string that I need to add before module abc line in 1.txt.