I have a TensorFlow TextVectorization layer named “eng_vectorization”: and I saved it in a pickle file, using this code: Then I load that pickle file properly as new_eng_vectorization: Now I am expecting, both previous vectorization eng_vectorization and newly loaded vectorization new_eng_vectoriz…
How to use a CSV file and use the CSV file to have an input from a user?
I have dataset about car accidents statistics by using a .csv file. I want the user to type in State and all of the information about that State gets displayed for the user to see. How can do that? Dataset: I’m thinking of something like this: Answer I suggest you use the standard-library’s csv mo…
How to assign different palettes to hue levels in a Seaborn barplot?
I’m using Seaborn to create bar plots in Python. I have a 2 (attention: divided vs focused) X 3 (solutions: 1,2,3) design. For divided, I want the bar colors to be darkred, darkgreen, darkblue. For focused, I want the bar colors to be red, green, blue. This code doesn’t work because the palette on…
Python-docx: Find and replace all placeholder numbers in Word doc with random numbers
I’m having trouble finding and replacing all occurrences of several placeholders within paragraphs of a Word file. It’s for a gamebook, so I’m trying to sub random entry numbers for the placeholders used while drafting the book. All placeholders begin with “#” (e.g. #1-5, #22-1, …
convert a list of pairs with a fixed suffix to a dictionary
I have a big list like the below one: and I want to make a dictionary of it like this: This means there are two types of elements: regular simple ones and the other ones with a fixed suffix that I want as keys or values. Answer You can just “ignore” the suffix elements and add them manually as val…
Skipping variable number of C-style comment lines when using pandas read_table
The pandas read_table() function enables us to read *.tab file and the parameter skiprow provides flexible ways to retrieve the data. However, I’m in trouble when I need to read *.tab file in a loop but the number of the rows need to skip is random. For example, the contents need to skip are started wit…
Tensorflow Lite, Image size is zero error
Actually, my question is very simple. I would like to use my own data in tensorflow lite model. So, i wrote these line of codes: Also, this is the error that I encountered: Answer This happens when the Dataloader cannot infer the labels of your images. The images should be divided into subfolders according to…
How can I parse just a section of big log based on datetime in python
I wanted to parse just a section of any given log. I just need to start from start_time of my log and end at end_time of my code. The datetime format is “[2021-09-14 21:56:01.768]” So basically suppose I needed to start from “[2021-09-14 21:56:01.768]” part of log and end at “[20…
Python Webdrivermanager .install() does not work for edge in custom webdriver installation location
I use Webdrivermanager to update my drivers. But for the Edge browser I get errors. The Error: Well I edited the manager, to save to another location. But it does work for Chrome and Firefox why not for edge… modified driver_cache.py: modified microsoft.py: Just to compare the edited and working chrome.…
AttributeError: ‘AnimalShelter’ object has no attribute ‘database’
I am not understanding why I am receiving this error as my .py file indicates that database is in fact an attribute. I have made sure that everything is indented as it should be and made sure that the correct .py is notated when importing AnimalShelter. I am following a walkthrough for this for class and the …