Currently the text I am dealing with are dates with a somewhat standard format, however the data isn’t super clean. For example the text can be in these formats: I’m not quite sure how to deal with this. I want to convert these strings into 2021-01-01 format. My plan was to convert to datetime object, and then convert back to
“NameError: name ‘numpy’ is not defined” when calling eval()
The line for e2 (but not e1) generates an error: Why? Answer I solved it by replacing: with:
How do I combine two print functions in python?
I want to print the output of two regexs run against the same file. I have tried and In each case the second print statement shows no output. If I run them separately they both show their unique output. How do I combine them so I see the output of both regular expressions? I can open the file twice of
How can I display the output as requested?
In Group B of the World Cup, the teams of Iran, Portugal, Spain and Morocco are present. I wrote a program that, after receiving the results of the games, would print the name of the team, the number of wins and losses, the goal difference and their points in one line, respectively. Each team is printed in order of points
How to overwrite `savefig` method so that it can unpack a tuple
I am working on a minimal extension to a piece of code. I have a make_fig function that used to produce just one figure, which I would call as fig in the lots of other fuctions then save it as fig.savefig. In the extension, make_fig now returns a tuple of figures. So, to save them all, I would now need
Transposing and Creating Flat files Using Pandas
I have the following table For each top level 3, there are sub levels 4,5,6, etc. For some level 3, there are no sub-level. I need to transpose levels and create a meaningful flat file like this using pandas. Answer I’ll probably be lynched for this but since there isn’t any better answer – hope that helps :-)
Kivy: Control + Backspace in TextInput to delete token
I’m trying to get my TextInput boxes to recognize a ctrl+backspace keystroke to backspace an entire token (like most modern programs). So far, I have this: I’m not sure how to detect the previous token from the cursor and delete it without interfering with the existing behavior of the do_backspace() method. Fyi, I am still using Kivy 1.11.1 and Python
Why do sometimes CNN models predict just one class out of all others?
I am relatively new to the deep learning landscape, so please don’t be as mean as Reddit! It seems like a general question so I won’t be giving my code here as it doesn’t seem necessary (if it is, here’s the link to colab) A bit about the data: You can find the original data here. It is a downsized
Ignore warnings whose messages contain a specific string
I don’t want warnings whose message contains “property” to be printed. I know that I can ignore a warning by specifying its whole message with: I need something like: I also know that I can disable warnings for a specific part of the code with: Answer The message parameter of filterwarnings is a regular expression, therefore you should be able
How to run a python script on Azure for CSV file analysis
I have a python script on my local machine that reads a CSV file and outputs some metrics. The end goal is to create a web interface where the user uploads the CSV file and the metrics are displayed, while all being hosted on Azure. I want to use a VM on Azure to run this python script. The script