Skip to content

Tag: python

What does the phrase “created at runtime mean?”

My supervisor asked me the other day if a log file in a Python script is created at runtime or not. Is that another way of asking: is a new log file created every time the script is run? Because to me everything happens “at runtime” and it can be no other way. How else could it be? Answer The

How to handle numbers embedded in text during NLP pre-processing?

I am trying to run the LDA algorithm on a data set of news articles. I understand that numbers must be removed during the pre-processing step, and I have written a simple regex code to replace numbers with blanks. However, I would like to retain some numbers since removing them can potentially change the cont…

how to get value from def function before

i got a problem to run the python, for example code in below, because the code not sure to see because i am beginner for this,and its too long too, i give the same problem on my code the problem is if i press the button for y1 not define so i writte the code but in my visual studio

Use global positions to mutate list, in list of lists

I need to keep my data in a list of lists, but want to edit elements in the lists based on their overall position. For instance: I want to change position 5 as if it was all one list resulting in: This is for very large lists and lots of mutations so speed is essential! Answer Here is the solution

String Slicing in c# using intervals

In python there are ways that allow you to access the string using an interval(slicing): Example Get the characters from position 2 to position 5 (not included): Is there something similar in c#? Answer In C# 8.0 (or higher) you can use ranges, e.g Or on old c# versions, Substring: Finally, you can use Linq, …

Python: Change a JSON value

Let’s say I have the following JSON file named output. If type key has a value datetimeoffset, I would like to change it to dateTime and if If type key has a value Int32, I would like to change it to integer and like this, I have multiple values to replace. The expected output is Can anyone help with th…