Questions tagged [python]

Python is a dynamic, strongly typed, object-oriented, multipurpose programming language, designed to be quick (to learn, to use, and to understand), and to enforce a clean and uniform syntax. Two similar but incompatible versions of Python are in use (Python 2.7 or 3.x). For version-specific Python ...

0
votes
0answers
4 views

Surpress scientific notation big numbers Python

I have this pandas data frame: Store Weekly_Sales 0 1 1.535134e+06 1 2 1.891811e+06 2 3 3.967824e+05 3 4 2.069359e+06 4 5 3.120745e+05 I would like to display ...
0
votes
0answers
8 views

How to visit a page in my Firefox profile using Python

I'm want to visit a lit of URLs (about 3000) so I can add them to my browser history in Firefox. I'm trying to do with Selenium but it's not working. name = "C:\Users\Default\AppData\Roaming\Mozilla\...
-3
votes
0answers
15 views

txt file into array in python [duplicate]

I'm new to python and i'm having a trouble with txt file and array. I have a text file which contains 12 numbers in one line. Loading from this txt file, I want to make 1x4 array for the first 4 ...
0
votes
1answer
20 views

Calculation in Python or SQL?

I am a data analyst in finance world so we always need to do a lot of calculations in Excel. E.g. calculating Debt to Equity ratio, Sales % of Revenue, etc. In Excel is pretty easy to write formula ...
0
votes
0answers
19 views

Python Boolean Usage in Tuples [duplicate]

I was looking at gcd in fractions.py and noticed this syntax if (b or a) < 0:. At first glance it seems intuitive but after digging deeper, I don't really know whats going on behind the scenes. ...
0
votes
0answers
4 views

Reset hadoop aws keys to upload to another s3 bucket under different username

Sorry for horrible question title but here is my scenario I have a pyspark databricks notebook in which I am loading other notebooks. One of this notebooks is setting some redshift configuration for ...
0
votes
0answers
5 views

Ttk Treeview root (parent, top level) nodes invisible

Have been stuck on this for a few days and cannot find any mention of someone experiencing this phenomenon. I have a Treeview and I am population the top level nodes and then sub level nodes but the ...
-1
votes
0answers
7 views

How to display multiple images inside tkinter window?

I want to display 7 different images and plot them inside tkinter window. I only know to display it using OpenCV which actually displays the image outside the Tkinter GUI window. How to plot the ...
0
votes
0answers
6 views

Keep Iterating the Results on different sheets of excel with python

I have list of queries i.e. queries = ['select * from emp', 'select * from dept', 'select * from user'] Now what I want is, to execute these queries, save their results in seperate sheets. Means I ...
-3
votes
0answers
23 views

rock Paper Scissors Python 3 with loops - not working

I can't find why my code is not working and functions are not allowed in that exercise. Thanks def main(): computer_random_choice = random.randint(1,3): if random_choice_one == 1 : ...
0
votes
0answers
10 views

Selenium Python: How to get css without targetting a specific class/id/tag

I'm working on a scraper project and one of the goals is to get every image from HTML & CSS of a website. I was using BeautifulSoup & TinyCSS to do that but now I'd like to switch everything ...
-1
votes
3answers
13 views

Python Loop iteration with replacement of null values in timeseries of a list

I need to replace null values with value of the list below in Python. Value will be same for any item through out the list if its not null. example of list [[1538140080000, None], [1538140140000, ...
0
votes
0answers
6 views

How to make my python program bypass Linux openssl and use my compiled one

I am running an experiment program in python using python3.6.5 and Openssl. I use Ubuntu 18 which comes shipped with OpenSSL 1.1.0g: openssl version -a OpenSSL 1.1.0g 2 Nov 2017 built on: ...
0
votes
0answers
25 views

Merge Two Link List in Python

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. I have it almost complete. I cant get it to work. Any ...
0
votes
2answers
14 views

Schedule task for one year from now

What is the best way to schedule an event for a month or a year from now? For example, I want my program to send a notification one year after a customer's registration. I try to use celery with ...
0
votes
1answer
4 views

Airflow Generate Dynamic Tasks in Single DAG , Task N+1 is Dependent on TaskN

When Generating Tasks Dynamically I need to have Task 2 be dependent on Task 1, Task1 >> Task 2 or task2.set_upstream(task1). Since the task_ids are evaluated, or seem to be upfront, I cannot set ...
0
votes
1answer
27 views

Extract urls from a string of html data

I already tried to extract this html data with BeautifulSoup but it's only limited with tags. What I need to do is to get the trailing something.html or some/something.html after the prefix www....
-1
votes
0answers
24 views

Python Regex: matching commas contained in quotes within a comma delimited string

so i have a string (actually a list of strings), something along the lines of: 12.34,54.65,86.97,72.34,"283,341",letters,01-03-1934 85.73,92.76,28.84,76.11,"1,333,444",moreLetters,04-03-1934 and ...
1
vote
0answers
6 views

Python SMTP - Receive email in Sent Items after email is sent to user

I'm sending an email to a list of users stored in a csv file. I've tested it multiple times and the emails are sent and received. However, I would like to see the eamils that have been sent in my '...
0
votes
1answer
7 views

selenium and python click element in a dropdown

still new to selenium, xpath works great most of time , but not with the drop down in this case, of selecting a element from a drop down box: the xpath of the box is: //*[@id="select2-report_object-...
0
votes
0answers
8 views

Install python requirements as --user

I am using the pydybm package: DyBM Github When I call python setup.py develop it install successfully, but when I later try to run: import pydybm it does not find the module. When I instead run ...
0
votes
1answer
6 views

Python Tkinter grids inside Classes

So I'm having this issue where I am trying to place a grid frame INSIDE another grid frame. I was able to pull it off in other programs. But for some reason, I'm not able to replicate this here. I ...
0
votes
0answers
7 views

How to use a symlog scale with log scale property of identical distance between labels

The plots below show 1st. a symlog scale (ax.set_xscale("symlog")) and 2nd. a log scale (ax.set_xscale("log") As you can see the 0 does not appear in the logscale but my x values consist of (0, 0....
0
votes
0answers
6 views

Keras / Tensorflow cumstom cross entroyp loss with dynamic masking

I'm trying to create a custom loss in Keras, using Tensorflow Backend. This custom loss is nothing but a cross entropy loss, where some output classes are masked. For information, the model is a ...
-2
votes
0answers
12 views

Python3 Pandas script not functioning

Hello guys I've got a error when I try to run my code I'm new so I don't know what's happening When I try to run my code it won't function instead it gives a error. My code: import pandas as pd # ...
1
vote
2answers
17 views

Python Round Function Issues with pyspark

I am relatively new to spark and I've run into an issue when I try to use python's builtin round() function after importing pyspark functions. It seems to have to do with how I import the pyspark ...
0
votes
0answers
9 views

Cache view without caching redirect

I want to cache this python view, however I would like to keep the redirect depending of the current user state. Aparently the code below will cache the redirect too of the first viewer and ignore the ...
0
votes
0answers
18 views

Given an array of integers, plot two stacks of colors next to eachother using Matplotlib for Python

So I have a list of numbers, example 11[1,1,1,2,3,2,20,30] I want to have each number correspond to a color (ie 1=blue, 2=cyan) then stack the first half of the colors (in this case 4) on the left ...
0
votes
0answers
24 views

There is a four letter word with the sequence 1223 and a six letter word with the sequence 142134. What are the words?

There is a four letter word with the sequence 1223 and a six letter word with the sequence 142134. The 1, 2, and 3 stand for the same letter in both words. What are the words? I am trying to solve ...
-1
votes
1answer
6 views

How to hide/show an axes, not axis in matplotlib

There are plenty of questions (and answers) as to how to hide/show axis on matplotlib figures. How can I hide/show whole axes? I have a figure containing five axes but I want to be able to hide (...
0
votes
1answer
15 views

Change maker with for loop

I'm trying to make a change maker with a for loop so it tells me how much coins (quarters, dimes, nickels, pennies) it takes to get to the inputted amount. Here is my code so far: amount = input("...
0
votes
1answer
16 views

Updating list of variables using 'for' loop fails

Title might be inappropriate as I have no idea what is happening, feel free to change. I had this Python 2.7 code which queries the movement limits from a device: pan_low_limit = int(self.send_query(...
0
votes
0answers
15 views

Exception in Tkinter Callback (Using Python Turtle)

I am making a text-based lunar landing simulation in turtle. When the player presses the space bar to go to the actual interface of the simulation, everything works fine. After I click on the screen ...
0
votes
0answers
5 views

Python play audio in sync with cv2 video

I am very new to the cv2 library, and since I recently discovered it is unable to play audio I wanted to know if there is another library that will allow me to play the audio in sync with the video ...
0
votes
0answers
19 views

Drawing a Table with Python - matplotlib

I have been trouble with trying to find a way to display a 3 element list in the form of a table. What I actually care about is drawing the table. I would like to draw a 1by3 table for each ylabel in ...
0
votes
1answer
21 views

Make python send emails with attachments

for a fun project (No malicious purposes) I am working on a keylogger. I have made a very simple keylogger here: from pynput import keyboard def on_press(key): file = open("C:\\Users\\mikur\\...
0
votes
0answers
23 views

ModuleNotFoundError: No module named 'xxx.conf'; 'xxx' is not a package

I have the following project structure: xxx ├── xxx | ├── settings | └── tests | └── __init__.py | └── conf.py | └── xxx.py | └── utils.py Thoes are the imports that I have in each file. ...
0
votes
0answers
5 views

Python keyring in Ubuntu 16.04. How do I use a keyring other than the Login one?

I am using a python keyring library (https://pypi.org/project/keyring/) to allow me to store and load passwords from an already implemented store instead of implementing file storage and encryption ...
0
votes
0answers
31 views

Invalid character in identifier (SyntaxError)

cmd traceback: EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' ^ SyntaxError: invalid character in identifier ...
1
vote
0answers
14 views

How To Search For A String In Python In A Changed Log File?

I'm trying to use python to search for errors in my logs and I'm using the attached code. My problem is that It keeps popping since it always finds the same "error" in the log. I actually want it to ...
0
votes
0answers
4 views

--javascript-delay for doing a screenshot using imgkit and Python

Using Python and imgkit (and wkhtmltopdf 0.2) library I'm trying to make a screenshoot for the whole page. After some preparation I'm calling a method make_screenshot (presented below - for now there ...
1
vote
2answers
28 views

Changed value in numpy array based on index and on criteria

I have a numpy array: arr = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) >> arr [[ 1 2 3 4 5] [ 6 7 8 9 10]] I want to take a portion of the array based on indices (not slices): ix =...
0
votes
0answers
3 views

returning to python3 with fg messes up arrow keys interpretation

When I'm in gnome-terminal (or Konsole) and run python3, arrow keys work as expected but when I CTRL+Z so I come back to terminal, then fg to bring-up python3 again, arrow keys are printed like ^[[A . ...
0
votes
0answers
5 views

Dash Integration for interactive graphs visualization in PHP based Website

I am working on a project in which I need to integrate dash into a website based on PHP for visualization of interactive graphs. Is it possible to integrate dash in PHP or I need to write the whole ...
0
votes
1answer
12 views

Kaggle airbus ship detection challenge.How to deal with class imbalance?

My model always predict under probability 0.5 for all pixels. I dropped all images without ships and have tried focal loss,iou loss,weighted loss to deal with imbalance . But the result is same.After ...
0
votes
0answers
10 views

Paramiko with pool.map for multiprocessing giving errors

I am writing a script to connect to a bunch of cisco routers and run commands on them, hosts and commands are put into a text file and then read from the script. Below is the code i got, when i don't ...
0
votes
0answers
8 views

Django pyinstaller error Import error myapp

I developped myproject with Django 1.11.8 and all it's ok Now I trying to generate the "myproject.exe" file by pyinstaller 3.4 This is the structure: myproject\ manage.py myproject\ ...
0
votes
5answers
69 views

Writing if statements as one-liners

I want to write one-liner if statements when i can avoiding two lines of code. if 10>5: print( "10 is greater than 5" ) else: print( "nothing here " ) While the following statement is ...
0
votes
3answers
46 views

write() argument must be str, not bytes python

I am new to python. I got this pre written code that downloads data in to report. But I am getting the error "write() argument must be str, not bytes". See below code def _download_report(...
0
votes
0answers
7 views

Navigation Toolbar was not working for 3D plots in python pyqt5. Which library to use to implement Navigation Toolbar for 3D plots in python pyqt5?

For Navigation Toolbar I was using from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar Its working well for 2D plots but not for 3D plots. Can anyone suggest me ...