Category "python"

Return Value from Function is None

Hello So i created a function to see if every character of a string is valid to be changed from base 10 to base 2(binary for example) but i dont know why everyt

Making a plot that has an x-axis that has neg. values representing hours prior to the start of the event, then pos. values representing hours after

I'm not sure if my question makes sense, so apologies on that. Basically, I am plotting some data that is ~100 hours long. On the x-axis, I want to make it so t

Mfcc classification: in sklearn how could I solve the dimension error of y

prediction_class = labelencoder.inverse_transform(predicted_label) prediction_class ValueError: y should be a 1d array, got an array of shape (1, 10) instead. p

Telethon (bot), how to work with commands, buttons and anwers

I want to implement something like BotFather. It sends buttons and you select your option, and if the option need a answer you must answer with the correct answ

ValueError: Excel file format cannot be determined, you must specify an engine manually

I'm trying to convert multiples files in a diretory to CSV format; I did this code, and ran it in 3 folders. But that one i get this error i found something li

Why does the function only add the last object?

Why does the function only return the last object from the request? And does not add a new one to the Data dictionary? def holdings(): data = {} res = r

Iterate trough a converted datetime pandas dataframe with a external function

https://rhodesmill.org/skyfield/positions.html#azimuth-and-altitude-from-a-geographic-position Hi I have function that generates a sun-shot azimuth on a specifi

O365-Rest-Python-Client - Struggling to get the displayname mapped

I am trying to convert a sharepoint list to a pandas dataframe. The Internal name is being returned by default I believe by the client, which isnt very useful

java.lang.NoClassDefFoundError: org/apache/hadoop/hive/ql/metadata/HiveException while running DAG in Airflow

I am running a python project through DAG in airflow, and I encounter the following exception when the dag runs this line from the project - df = spark.sql(quer

Pycharm pytest run configuration - how to remove redundant argument

Every time I'm trying to run Pytest with debugger - unexpected "-k" argument is passing automatically and this causes run error. I can't find this argument anyw

Cant send discord button

I get no errors or anything. Using newest version of discord.py v2. @client.command(aliases = ["Rock Paper Scissors", "RPS", "Rockpaperscissors", "rockpaperscis

how to access a specific data in two columns using if and statement

My Data Frame My Code: a = 10001 b = "01.01.2001" if a == np.any(df["Token_ID"]) and b == np.any(df["Date_of_birth"]): print("yes") else: print("no")

In Anaconda couldn't download older version of scikit learn package using "pip install scikit-learn==0.21.3" Collecting scikit-learn==0.21.3 Using c

I'm getting this error:Collecting scikit-learn==0.21.3 Using cached scikit-learn-0.21.3.tar.gz (12.2 MB) Requirement already satisfied: numpy>=1.11.0 in c:\u

How to use python to merge multiple sheets from an excel file and values from particular cells

I have an excel file with multiple sheets, the actual data I need from each sheet is from cell B7 to F38, how can I merge all the sheets' data into one by using

I modify response.data in Django REST Framework view.py. Why am I getting an AttributeError during testing but not with actual API use?

My Django REST Framework API is working just as expected. In view.py, I modify OrderViewSet, def partial_update, to add another key/value pair to the response.d

How can I create multiple hillshade maps using a for loop that searches a table?

import arcpy.sa arcpy.env.workspace = r"C:\Users\nhaddad\Desktop\project_8" arcpy.env.overwriteOutput = True altitude_cursor = arcpy.da.SearchCursor("sol

outlook does not send the email I want to send. why?

whenever I run this function I can see only the print result of time and date. the lines below do not get executed nor they throw any error. what is the issue?

Why are my matrix values being reset back to 1?

I can't seem to figure out why the values of the first column after the 3 are being reset to 1 and then 1 again. I think it has to do with the not 999 if statem

How sklearn.metrics.r2_score works

I tried to implement formula from Wikipedia but results are different. Why is it so? y_true = np.array([1, 1, 0]) y_pred = np.array([1, 0, 1]) r2 = r2_score(y_

Find first and last value greater than 0 in a list in python

It is a list based on a solar measurement system so in the first hours of the day it will be 0 and in the last hours of the day it will be 0, so I am interested