Questions tagged [python-3.x]

For questions about Python programming that are specific to version 3+ of the language. Use the more generic [python] tag if your question is not version-specific.

0
votes
0answers
2 views

How to load the images with class labels from a single directory into Keras model using?

I have 13 separate folders in the same directory, each folder containing images of a particular class. How can I read all the images from all the folders?
0
votes
0answers
6 views

Identify possession phrases and the object being possessed by another object in python3

Is there a way to identify the object being possessed by another object in python3 using nlp libraries. For example, "The beautiful dog of Bob", "Bob's beautiful dog", should both return beautiful dog ...
0
votes
0answers
3 views

Connecting to the PostgreSQL database… connect() argument after ** must be a mapping, not NoneType

Trying to duplicate the process of connecting to a local host PostgreSQL database by the example presented at http://www.postgresqltutorial.com/postgresql-python/connect/ Used the base environment ...
0
votes
0answers
5 views

python aiohttp slow response time

I am using the aiohttp client session to retrieve webpage asynchronously. async def fetch(session, url): #async with session.get(url) as response: async with getattr(session,"get")(url) as ...
0
votes
0answers
3 views

How to create a 4D numpy array to hold the data, then loop through the list of files from the pandas dataframe,

I have to create a 4D Numpy Array to hold the data, then loop through the list of files from the pandas dataframe, inserting each image at the index indicated from the number column. I have a ...
-2
votes
1answer
14 views

Instances of Classes --> Method Overwrite Problem

person1 = Person("Michael") person2 = Person("Johnny") So basically, I have two instances of a class called Person. I have no issues with this, they are created successfully. I want to set their age ...
0
votes
0answers
4 views

I keep receiving the error “type object argument after * must be an iterable, not Skull” while trying to make a text file readable as a map

working on a tile-based game on pygame. I am trying to read a text file as the map however, I keep getting a Type error that I do not know how to fix for row, tiles in enumerate(self.map_data): ...
0
votes
0answers
6 views

How to get synonym for multiple word using NLTK?

I have searched that all questions only provide the way to get synonym for one word, but it doesn't work when I try to use a for loop to get synonym for multiple words. This is my code, but it doesn'...
0
votes
0answers
4 views

How can I extract the least significant bits of a line in an image?

I've been working on solving a steganography and cryptography challenge in an image, here are the solutions I try to solve by myself (they are more of a solution): 1. Retrieve the alpha channel color ...
0
votes
1answer
17 views

Python dataframe rows contains multiple list of string search

I have a list of elements in string format that I want to search in each row and delete others. Below code is working however, it is replaced the search from the last element of the list. I am trying ...
0
votes
0answers
10 views

Get Current Web Hyperlink in Flask [duplicate]

I have a flask app that has searchable content. When the users enter a search term, they have the choice to choose from many results that each have a unique hyperlink. These results have strange ...
0
votes
0answers
10 views

How can you find when a value changes throughout every row in a data frame?

I am attempting to label accounts as new, current, lost, or returning but am having trouble with the logic. The row index is the account and the columns are the years and the values are 1's and 0's ...
0
votes
0answers
9 views

Pyhton 3.6 Messy String with Unicode characters and Bytes

So I am taking articles titles from the Common Crawl news repo using NewsPlease, but when I take the articles titles, but they are a mixture of normally encoded characters and Unicode bytes, and I am ...
0
votes
0answers
19 views

Why should I “use inline comments sparingly”?

Reading PEP8 (https://www.python.org/dev/peps/pep-0008/#comments), I see that programmers should "use inline comments sparingly". No reason for this is provided, though. I wonder why. I really find ...
0
votes
1answer
39 views

Variables as Values in Python Dictionary

I have 4 private variables: __first = 0 __second = 0 __third = 0 __fourth = 0 I added them to a dictionary like this: numbers = {one: __first, two: __second, three: __third, fourth: __fourth) When ...
0
votes
0answers
7 views

Multiple conditions checking to avoid duplicates in twoSum solution

I device three solutions to twoSum problems Given all arrays of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would ...
1
vote
3answers
33 views

Trying to Sum Key Value Pairs in a Dictionary

I have been struggling with understanding how to sum values from key value pairs in a dictionary. Printing the dictionary yields something similar to the following: print(cust.p) {datetime.datetime(...
0
votes
0answers
14 views

How to more accurate aggregate values in dataframe by python?

This is my result made by code il = wb[["region","incomeLevel"]] count_il = il.groupby("incomeLevel") count_il.count() It looks fine, but how can I made it perfect that the result gives me more ...
0
votes
0answers
17 views

Multiprocessing python within frozen script

I am trying to compile a script utilizing multiprocessing into a Windows executable. At first I ran into the same issue as Why python executable opens new window instance when function by ...
0
votes
0answers
9 views

Unable to run Turtle graphics script more than one time in PythonWin

Learning Python and coded simple Turtle graphics script using PythonWin. The script will execute only one time from PythonWin. On subsequent attempt, the script hangs on the line that creates the ...
0
votes
1answer
24 views

NoReverseMatch: Reverse for '' not found. '' is not a valid view function or pattern name

Help me please! Sorry about my english , i'm weak in english! I am trying to visit this page 192.168.56.102 / project / BP / 4, it shows me this msg error! the same configurations of urls and views ...
-2
votes
0answers
13 views

Prevent the user from altering window size and position for a webdriver

I am aware of the possibility of starting the browser instance at a given size and position. But i don't seem to find a way to fix the position of the window on the screen permanently. At the same ...
0
votes
0answers
12 views

How to overcome the Wrong merging When using Pivot_Table?

I have Two Dataframes ,What I'm trying to to do , is to create new columns based on the Sensor_Type and add them to DF1 and assign each measurement based on the Sensor. DF1: Weather_Legends.head():...
0
votes
0answers
18 views

How do I implement mean shift by using a grid of centroids?

This is for a class and I would really appreciate your help! I need to modify an existing function that implements the mean-shift algorithm, but instead of initializing all the points as the first set ...
-2
votes
0answers
10 views

How can I convert a python dataframe to an output like flare.json

So I want to create a hierarchial tree in D3 that can be found here : https://gist.github.com/mbostock/4339083. My dataframe is like : Supervisor Employee 0 NaN ...
0
votes
0answers
9 views

getting rid of control character with ncurses and threaded class

I'm trying to develop some kind of terminal user interface in python3 with threading and ncurse and some weird characters appear. Based on the answer in this post: Threading with Python Curses ...
0
votes
1answer
20 views

How to download in-between videos from Youtube playlist using pytube

Suppose there are 10 videos in a playlist. It's simple to download the whole playlist, that is 1 to 10 videos, using a couple of pytube commands. How can we download, suppose 6 to 10? I am using 3.6.5 ...
1
vote
1answer
27 views

Character b is appended to output of numpy array?

Below is my code and is working fine. the only problem is that print output prints character b at the starting of each element. have no idea why it is happening. can someone please help on this. ...
0
votes
0answers
7 views

update instruction of the deprecated tensorflow dataset sliding window with tf.data.experimental.CsvDataset

I am trying without success to update my code with the instruction given in the tensorflow documentation (api r1.13). I am using the tf.data.experimental.CsvDataset and the deprecated tf.contrib.data....
0
votes
0answers
28 views

What is the bug in my code for find the prime number list

I want to get a prime number list. 15 should not occur as per the definition of prime number. But it showed on my output. I don't know what happened. python import math n = input('n') n = int(n) A = ...
0
votes
1answer
35 views

Is there a way to ensure a function runs to the end before another starts?

Here is what I do : I have a png plan for different sections in a library. In PyQt5 I have a button for each section which when pressed alternates the base png with a copy that has the corresponding ...
0
votes
0answers
9 views

Python error sending image over socket with pickle

I am creating a program that sends a video stream over a socket, and I am using pickle to load/dump my image numpy array. I am sending pictures fast so I can receive frames fast and make a live video ...
0
votes
1answer
17 views

PyQT5 App with Selenium Not Responding - Not showing the progress bar and Not Emitting the text in Console until the task is completed

Window title is showing as Not Responding when using PyQt5 and selenium. The progress bar and the console emit stream displays after the completion of execution of script. Need help in getting this ...
1
vote
3answers
40 views

Problem with passing parameters and scopes, how can I fix this?

I'm making a password generator and strength checker (I'm new to coding), and my problem is that I can't get a function working that generates a password, calls the function that checks the strength, ...
-2
votes
1answer
26 views

How do I keep terminal zeroes when rounding to a set number of decimal places? [duplicate]

Problem requires to output decimal proportion of negative integers in an unknown list. The desired answer is 0.500000 (6 decimal places), but my program only outputs 0.5. How do I keep the 5 ...
0
votes
1answer
19 views

How do I pack dataframes in a set or reference them without mutating them? Python 3

I have 3 pd.DataFrame objects: A, B and C. I want to summarise them in a set (eg: set(A,B,C)) because I want to loop through a list and do things to it but I also don't want to mutate the dataframes ...
0
votes
0answers
31 views

How to fix 'The truth value of an array with more than one element is ambiguous' error in Python 3.7 [duplicate]

I got this code from youtube, not sure, why the tutor(Sentdex) is not getting the same error as I am. I have a Test.csv file with dates as Index Dates 'A Close' 'B Close' 'DLF Close' 'ICICI Close' ...
-2
votes
1answer
42 views

How to add a set every time to a set in a loop

I tried to write a program that add a different set to a set every time, so I tried this: for i in range (5): Set = set() Set.update(set(str(i))) But unfortunetly I got this result when I ...
0
votes
1answer
29 views

JSON.parse error while writing json data into json file

I am trying to get JSON data from a localhost URL row by row and insert it into a JSON file. When I try to open the file, I receive an error that says Multiple JSON root elements. import urllib....
0
votes
0answers
14 views

Use django-filters on multiple models

I'm trying to create a search capability in my Django project that will filter multiple models (currently 3). It worked great for one model, worked when I added a second, but when I tried to add a ...
0
votes
0answers
22 views

Why pandas broadcast is much faster than iterate? How does it work? [duplicate]

I have a Pandas DataFrame that stores first_name, last_name, and full_name. They came from different data source and I joined them together by ID. My task is to check if first_name + last_name and ...
0
votes
1answer
21 views

Check if a file type is a media file?

I am trying to loop through a list of files, and return those files that are media files (images, video, gif, audio, etc.). Seeing as there are a lot of media types, is there a library or perhaps ...
0
votes
0answers
19 views

How to create a “go back Button” on a second window with tkinter?

I'm doing a little "Supplementshop" with python 3.7.2 and tkinter. I want to use a "go back to the main window"-button. Because I'm creating new windows through buttons and functions, I think I can't ...
0
votes
0answers
8 views

Pandas.ExcelWriter not behave the same after pyinstaller to exe file

I am a absolute beginner of python and working on a small program to collect data and write multiple sheets to Excel using pandas, it worked as expected. However after convert to exe file using ...
0
votes
2answers
24 views

Loop through groups to do operation on

I have this similar dataframe as below:- WELL RESV TYPE X1 Y1 X2 Y2 TD2 0 W1 A OP 100 250 500 -5 495 1 W2 B INJ 120 255 700 -7 695 2 W3 B OBS 140 260 ...
0
votes
0answers
16 views

How to Extract and Display Album art from a Mp3 file in python

I'm making a Music player with GUI using tkinter on pychar. I wanted to display the the embedded album art in the mp3 file but im unable to find any way to do that I have tried using Mutagen but ...
0
votes
1answer
12 views

Eroor django-urls

from django.urls import path, re_path from . import views app_name="home-app" urlpatterns = [ path('nueva-url', IndexView.views(), name='index')#this synthesis does not work, it gives me an error. ...
0
votes
1answer
17 views

How to retrieve value from selected radiobutton after root.mainloop()?

I am looking to write a pop-up window which asks the user to select a specific option, and if the option does not exist, to add it. However, I am having trouble retrieving the value of the selected ...
0
votes
2answers
27 views

How to find string from a list of strings with a specific list of characters?

I have a given list of string and a list of characters and I want to check the string with containing a specific character. Here is an example: Dictionary = ["Hello", "Hi"] Character = ['e','i'] it ...
0
votes
0answers
13 views

H2O Target Mean Encoder “frames are being sent in the same order” ERROR

I am following the H2O example to run target mean encoding in Sparking Water (sparking water 2.4.2 and H2O 3.22.04). It runs well in all the following paragraph from h2o.targetencoder import ...

http://mssss.yulina-kosm.ru