Skip to content
Advertisement

Tag: function

random number generating function as argument in python

I want to pass a function which generates random normal numbers to another function, do some calculations and pass again the random function x times. At the end there should be a Dataframe with x colums with diffrent randomly generated outcomes. My code looks like this: But this gives me always identical columns. Answer I don’t think you can pass

why returning None in functions python?

first image I was having problem when I run this code I raise exception in function then why none is printing sec image And in this case none is not printing.. pls help Answer when a python function does not have a return statement it automatically return None. In the first image, the print(numcheck(5)) pass the assert but the function

Re Regular expression operations, remove periods?

I’m working with a function I made to split this sample line below to remove the standalone numerical values (123), however it’s also removing the trailing numbers which I need. I also can’t figure out how to remove the “0.0” ABC/0.0/123/TT1/1TT// What’s coming out now is below, notice the 0. and “TT” that’s missing the trailing 1. [ABC], [0.], [TT],

How to create dictionary from multiple dataframes?

I have a folder with several csv files. Example of the dataframes from csv files in directory: I need to make a function that accepts route to file directory and return sites frequency dictionary (one for all sites in file directory) with unique sites names the following kind: {‘site_string’: [site_id, site_freq]} For our examle it will be: {‘vk.com’: (1, 2),

changing the name of a function in a loop

I didn’t find the answer my problem I have function with names stage_1(), stage_2() e.t.c (to 8). Can I run it using loop? I know this is wrong. what is the right way? Answer I have function with names stage_1(), stage_2() e.t.c (to 8). Actually this is a very bad idea. Can I run it using loop? For sure! You

Advertisement