Best Python code snippet using pandera_python
day.py
Source: day.py
1import datetime2from gtts import gTTS3import os4import random5import playsound6import time7import string8# dictionary containing the list of things used for later9dict_days = {1: 'Monday', 2: 'Tuesday', 3: 'Wednesday', 4: 'Thursday',10 5: 'Friday', 6: 'Saturday', 7: 'Sunday '}11dict_months = {'01': 'January', '02': 'February', '03': 'March', '04': 'April', '05': 'May', '06': "June",12 '07': 'July', '08': 'August', '09': 'September', '10': 'October', '11': 'November', '12': 'December'}13time_12hr = {'13': '01', '14': '02', '15': '03', '16': '04', '17': '05', '18': '06', '19': '07',14 '20': '08', '21': '09', '22': '10', '23': '11', '00': '12'}15# voice assistant16def voice_output_time(answer):17 audiocreated = gTTS(text=answer, lang='en', slow=False)18 a = random.randint(1, 999)19 audiocreated.save(f'tts_temp-{a}.mp3')20 playsound.playsound(f'tts_temp-{a}.mp3')21 os.remove(f'tts_temp-{a}.mp3')22 return answer23# to show the current time24def day_now():25 day_today = str(datetime.date.today()).split('-')26 time_now = time.ctime().split()27 final_time_now = ''28 if time_now[-2][:2] in time_12hr.keys():29 final_time_now += f'{time_12hr[time_now[-2][:2]]}{time_now[-2][2:5]} PM'30 elif time_now[-2][:2] == '00':31 final_time_now += f'{time_12hr[time_now[-2][:2]]}{time_now[-2][2:5]} AM'32 elif time_now[-2][:2] == '12':33 final_time_now += f'{time_now[-2][:2]}{time_now[-2][2:5]} PM'34 else:35 final_time_now += f'{time_now[-2][:2]}{time_now[-2][2:5]} AM'36 day = datetime.datetime.now().isoweekday() # to determine the current day of the week37 final_format = f'Today is {dict_days[day]}, {day_today[2]} {dict_months[day_today[1]]} {day_today[0]}, {time_now[-2][:5]}'38 asis_format = f'Today is {dict_days[day]}, {day_today[2]} {dict_months[day_today[1]]} {day_today[0]}, {final_time_now}'39 return asis_format, final_format40# checking the user input. If counter > 3 then it will recognize that the user is trying to ask what is the41# current weather of the city, else it will pass the statement and instead go to google or any search engine42# the user has specified for further search.43def check_userinput(usrinput):44 day = datetime.datetime.now().isoweekday() # to determine the current day of the week45 if 'what day is tomorrow' in usrinput:46 if day + 1 == 8:47 day = 148 tomorrow = f'tomorrow is {dict_days[day]}'49 print(tomorrow)50 return tomorrow51 else:52 tomorrow = f'tomorrow is {dict_days[day]}'53 print(tomorrow)54 return tomorrow55 elif 'what day is yesterday' in usrinput:56 if day - 1 == 0:57 day = 758 yesterday = f'yesterday is {dict_days[day]}'59 print(yesterday)60 return yesterday61 else:62 yesterday = f'yesterday is {dict_days[day - 1]}'63 print(yesterday)64 return yesterday65 usrinput = usrinput.split()66 counter = 067 time_check_input = ['current', 'time', 'now', 'today', 'what', 'it', 'year']68 for items in usrinput:69 if items in time_check_input:70 counter += 171 else:72 pass73 print(counter)74 return counter75"""76usrinput = 'what day is it today'77input_check = check_userinput(usrinput)78if type(input_check) == str:79 voice_asis = voice_output_time(input_check)80else:81 if input_check >= 2:82 time = day_now()83 print(time[0])84 voice_asis = voice_output_time(time[1])85 else: pass...
dataframe_schema.py
Source: dataframe_schema.py
...51 def setup(self):52 self.in_schema = DataFrameSchema({"column1": Column(String)})53 self.out_schema = DataFrameSchema({"column2": Column(Int)})54 self.df = pd.DataFrame({"column1": ["a", "b", "c"]})55 def time_check_input(self):56 @check_input(self.in_schema)57 def transform_first_arg(self):58 return Decorators.transformer(self.df)59 def mem_check_input(self):60 @check_input(self.in_schema)61 def transform_first_arg(self):62 return Decorators.transformer(self.df)63 def peakmem_check_input(self):64 @check_input(self.in_schema)65 def transform_first_arg(self):66 return Decorators.transformer(self.df)67 def time_check_output(self):68 @check_output(self.out_schema)69 def transform_first_arg(self):...
Check out the latest blogs from LambdaTest on this topic:
I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.
When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.
Pair testing can help you complete your testing tasks faster and with higher quality. But who can do pair testing, and when should it be done? And what form of pair testing is best for your circumstance? Check out this blog for more information on how to conduct pair testing to optimize its benefits.
People love to watch, read and interact with quality content — especially video content. Whether it is sports, news, TV shows, or videos captured on smartphones, people crave digital content. The emergence of OTT platforms has already shaped the way people consume content. Viewers can now enjoy their favorite shows whenever they want rather than at pre-set times. Thus, the OTT platform’s concept of viewing anything, anytime, anywhere has hit the right chord.
Have you ever visited a website that only has plain text and images? Most probably, no. It’s because such websites do not exist now. But there was a time when websites only had plain text and images with almost no styling. For the longest time, websites did not focus on user experience. For instance, this is how eBay’s homepage looked in 1999.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!