Category "python"

How to use loop in this case inside the function?

def get_day_type(info): day_type = (info[info.find("(")+1:info.find(")")]) holiday = ["Sun", "S

How to reduce the size of my dataframe in Python?

working on NLP problem I ended up with a big features dataset dfMethod Out[2]: c0000167 c0000294 c0000545 ... c4721555 c4759703 c4759772 0

How can I copy blob files from one account to another in azure

I have tried copying azure blob files from one account to another with the following python script ... source_block_blob_service = BlockBlobService(source_accou

I want to animate the solar system with python matplotlib

So basically I have this project at school where we decide something we want to plot. I decided to plot the solar system animated to find out when is the next t

Weird address issue with linked list implemented by numba jitclass

I'm trying to implement an LRU cache with doubly linked list and hash map. The doubly linked list is quite simple to implement by following the official example

Flatten list of dictionaries in dataframe

I'm pulling data with Facebook Insights API and there are nested columns in the data I pull. I tried separating them by index but failed. column I want to split

How can I plot Gaussian pseudo-random noise for N = 2?

How would one plot the Gaussian pseudo-random noise when N = 2 from the given code below? I don't know how to incorporate N into the formula in the code. I need

BeautifulSoup getting href of a list with ++ 10k records

BeautifulSoup getting href of a list with ++ records I have the following soup: <a href="some_url">next</a> <span class="class">...</span&g

How to use custom authentication class inside ListAPIView

I am using react components and to test my code I wrote a quick custom authentication class and defined in the settings for the rest_framework as follow: DEFAUL

Continuous scraping (each second) of dynamic webpage with selenium

I am scraping website with selenium successfully using following code: import os import time from selenium import webdriver from selenium.webdriver.common.by im

How to traverse through azure subscriptions?

In the code below, I want to show blob properties by traversing through azure subscriptions. But I'm facing an error 'SUBSCRIPTION' object is not subscriptable.

np.max() error: TypeError: only integer scalar arrays can be converted to a scalar index

I'm trying to get the np.max() function to work like a relu() function but keep getting this error: >>>np.max(0, np.arange(-5, 5)) -------------------

Song doesn't play on queue

This is error TypeError: on_wavelink_track_end() missing 1 required positional argument: 'player' This is wavelink track end code @bot.event async def on_wave

for one member of list or tuple, why typeerror is given?

if x = [1,2] then print(x[0]) gives 1 but, when x = [1] or x = (1) then print(x[0]) gives int object is not subscriptable. I actually want to know why it gives

Solving multiple equations using R's caracas package

I have multiple equations that I want to solve using caracas. I define my equations using sympy$Eq, then try to solve the equations using sympy$solve. But this

Replace items of a longer list with matches from a shorter list

My goal is to compare two lists as follows: Take every item in long_list and compare it for substrings to the entire short_list. If there is a match, add the it

Install requirements.txt uses a different path

Fellow users, I am trying to install a requirements.txt file (via cmd prompt: "pip install -r "path\to\file"). The problem is that my system returns an OSError

Regex to match Python docstrings

I would like to parse Python docstrings as follows: Summary of class that is multiple lines. Parameters ---------- param1 : str Param 1 is a param Returns

Filtering list of objects based on attribute

I have 4 objects. class MyObject: def __init__(self, id: int, result_name: str): self.id = id self.result = Result(result_name) class Resu

Python substring matching question and or logic [duplicate]

I am starting to learn Python and writing a small script with the following logic and can understand the reason for the output or the results