validation

How to validate based on specific Enum member in a Fastapi Pydantic model

How to validate based on specific Enum member in a Fastapi Pydantic model Question: Here is my Pydantic model: from enum import Enum from pydantic import BaseModel class ProfileField(str, Enum): mobile = "mobile" email = "email" address = "address" interests ="interests" # need list of strings class ProfileType(str, Enum): primary = "primary" secondary = "secondary" …

Total answers: 1

read a csv file and validate whether input parameter is in the csv file then bypass the purge process otherwise initiate purge process using python

read a csv file and validate whether input parameter is in the csv file then bypass the purge process otherwise initiate purge process using python Question: sample csv file: test.csv process_cd ramsize dbsize protocal random function will be called with below parameters self.complete_stage_purge_process(self.targetCnxn, self.targetTable, self.processCode) sample process codes: test protocal forensic each time function is …

Total answers: 2

How to delete a dataframe cell based on the value of the right cell

How to delete a dataframe cell based on the value of the right cell Question: I have a dataframe (df) where column V01 validates column D01. If the value on column V01 is ‘N’, then value of column D01 in the same row is invalid and should be deleted. import pandas as pd df = …

Total answers: 5

High accuracy training but low accuracy test/prediction

High accuracy training but low accuracy test/prediction Question: I am using CNN to classify apple type. I achieved high accuracy on train data but really low accuracy on test data. Data is split into 80:20. I am not sure if my data is overfitting or not. I have 2 folders that contain TraningData and TestData, …

Total answers: 2

How Do I Check RegEx In Integer Form

How Do I Check RegEx In Integer Form Question: I am trying to do the Advent Of Code 2022, 1st problem. (DONT TELL THE ANSWER). What i am doing is reading the file and taking each number and adding it to a sum value. What happens is, when I come across the "n", it doesn’t …

Total answers: 1

Validating file paths in Python

Validating file paths in Python Question: I have this code where the user has to input the name of a file which includes a message and the name of a file where the message must be written after its encrypted via Caesar-Cipher. I would like to validate the inputs, so that if there’s a wrong …

Total answers: 2

Disapprove password if it contains exactly 4 digits (validation)

Disapprove password if it contains exactly 4 digits (validation) Question: I can’t figure out how to modify my regex to make sure the password follows the last condition: at least 2 capital letters in a row doesn’t have space symbols contains digits doesn’t contain 4 consecutive digits {4} It currently disapproves the password if it …

Total answers: 1

Improve Column Validation For Multiple Dataframes Pyspark

How to improve Column Validation For Dataframes Pyspark Question: I have a function that validates if the dataframe passed has a few columns and if it does not it creates them and fills the values with 0.0. This takes a bit of time to run and has several if statements. Is there any way this …

Total answers: 1

Validate dataframe dates, return non-matching values

Validate dataframe dates, return non-matching values Question: This is the workflow I need to accomplish: Validate the date format of all dates in column_1 and column_2. If date is not in either format: mm/dd/yy hh:mm or mm/dd/yyyy hh:mm Need assistance – Print the non-matching values. Note: I do not know what format the dates will …

Total answers: 2