Questions tagged [python]

Python is a multi-paradigm, dynamically typed, multipurpose programming language. It is designed to be quick to learn, understand, and use, and enforce a clean and uniform syntax. Please note that Python 2 is officially out of support as of 01-01-2020. Still, 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.

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

Any help? Im importing packages but i keep getting the same error, tried updating some but still cant figure it out. code and error below

Any help? Im importing packages but i keep getting the same error, tried updating some but still cant figure it out. code and error below # Efficient numerical arrays. import numpy as np # Data frames....
0
votes
0answers
5 views

for loop that uses selenium to fill a data frame. Why does it only fill the first row?

I have a list of elements from a web page that I want to iterate through. I want to click on each element then grab data from the page that element linked to. I need to save this data to a data frame....
0
votes
0answers
6 views

Why time.mktime and datetime.timestamp generate different timestamps with the same date string input?

I am trying to convert the date string to timestamp but through implementing the following ways, I get different results: import time import datetime date = "11/10/2020" # First way print(...
0
votes
0answers
6 views

What is the fastest way of selecting the subset of a matrix?

Let's say I have a 2D matrix and I want to plot its values in a histogram. For that, I need to do something like: list_1d = matrix_2d.reshape((-1,)).tolist() And then use the list to plot the ...
0
votes
0answers
7 views

joining two rows into one row while keeping content

I'm trying to merge two rows into one row while keeping the content within them. this is my dataset model DLC DLC DLC 0 part arm arm arm 1 coord x y probability and this is my target ...
0
votes
0answers
6 views

Skip weights of one epoch in Tensorflow Keras

In my machine learning task I have the problem, that in some rare cases (epochs) the optimiser sees a bad training set and the weights and biases get completely messed up after that epoch, so I would ...
0
votes
0answers
12 views

Selecting text between two strings by matching using regex

I know there are similar posts to get the text between two strings but I couldn't figure out what's wrong with my code even after multiple tries, so I decided to post a question. The text data I am ...
1
vote
0answers
9 views

Crossover of two binary representations

I'm trying to get a quick implementation of the following problem, ideally such that it would work in a numba function. The problem is the following: I have two random integers a & b and consider ...
1
vote
0answers
8 views

pandas read csv ingore ending semicolon of last column

My data file looks like this: data.txt user,activity,timestamp,x-axis,y-axis,z-axis 0,33,Jogging,49105962326000,-0.6946376999999999,12.680544,0.50395286; 1,33,Jogging,49106062271000,5.012288,11.264028,...
0
votes
0answers
10 views

Replace missing values in Pandas with previous value if not NAN

I need your help with the following code. I have df1 with Exchange Rate and Date Columns that I'm trying to merge with df2. The df1 has missing values for the Exchange Rates (on weekends and holidays)...
-1
votes
0answers
12 views

How do I keep class values constant across functions in python(pygame)?

Ok so what I'm trying to do is create a turn based game system where there's a function which runs the part of the code where the player 'attacks' and then another function is called where the ...
-1
votes
0answers
8 views

How do I solve this error? fetch_all() IndentationError: unindent does not match any outer indentation level [duplicate]

I would like you to help me with an indentation problem. The fact is that I did 3 functions the first function is a second window in tkinter the second is a button to save data in Mysql and the third ...
0
votes
0answers
8 views

Kivy [Window] Unable to find any valuable Window provider. ( I tried other answers but it did not work) Thanks in advance?

Hi guys I have a problem when trying to run a simple code in vs code for an app using Kivy Lib I already installed all the components to run kivy the code I use : import kivy kivy.require('1.11.1') # ...
-3
votes
0answers
18 views

How to use external files in python [closed]

I tried to add some external modules to my code but it gave me an error, here's my code: import testm print(testm.names[2]) and here's the code of the external file (simple example): names = ['Riad',...
-5
votes
2answers
26 views

python:Runtime error list index out of range [closed]

When I try to run this code I get a runtime error but I am not able to figure out how I am exceeding the index of the list. n = int(input()) arr = map(int, input().split()) num=list(arr) num1=list(arr)...

15 30 50 per page
1
2 3 4 5
104753