Best Python code snippet using pandera_python
filters.py
Source:filters.py
1from rest_framework.filters import OrderingFilter2from django_filters.rest_framework import DjangoFilterBackend, FilterSet3from django_filters import rest_framework as filters4from distutils.util import strtobool5from .models import Platform, Institution, Parameter, Ferrybox, Cdf_Institution, getModel6from django import forms7#imports for custom lookups8from .lookups import NotEqual, NotIn9from django.db.models.fields import Field10BOOLEAN_CHOICES = (('false', 'False'), ('true', 'True'),)11class PlatformFilter(FilterSet):12 Field.register_lookup(NotEqual)13 #Field.register_lookup(NotIn)14 status = filters.TypedChoiceFilter(choices=BOOLEAN_CHOICES, coerce=strtobool)15 class Meta:16 model = Platform17 fields = {18 #filters:'exact','ne', 'lt', 'gt', 'lte', 'gte', 'in', icontains19 'id': ['exact', 'ne', 'in'], #notin20 'pid': ['exact', 'ne','in'], #notin21 'tspr': ['exact', 'ne'],22 'type': ['exact', 'ne', 'in'], #notin23 'inst': ['exact'], #einai kai kleidi gia institutions opote ftiaxnei drop down me ta institutions24 'inst__id': ['exact', 'in'],25 'dts': [ 'lt', 'gt', 'lte', 'gte', 'icontains'],26 'dte': [ 'lt', 'gt', 'lte', 'gte', 'icontains'],27 'lat': ['lt', 'gt', 'lte', 'gte'],28 'lon': ['lt', 'gt', 'lte', 'gte'],29 'status': [],30 'params' : ['icontains'], 31 'platform_code': [],32 'wmo': ['exact', 'ne', 'icontains'],33 'pi_name' : ['icontains'], 34 'author' : [],35 'contact' : [],36 'island': [],37 'pl_name' : [],38 'inst_ref' : [],39 'assembly_center' : ['exact', 'ne', 'in'],40 'site_code' : [],41 'source' : [],42 'cdf_inst': ['exact']43 }44class InstitutionFilter(FilterSet):45 Field.register_lookup(NotEqual)46 #Field.register_lookup(NotIn)47 class Meta:48 model = Institution49 fields = {50 #filters:'exact','ne', 'lt', 'gt', 'lte', 'gte', 'in', icontains51 'id': ['exact', 'ne', 'in'], #notin52 'name_native' : ['exact', 'ne', 'icontains'],53 'abrv' : ['exact', 'ne', 'in', 'icontains'], #notin54 'country' : ['exact', 'ne', 'in', 'icontains'], #notin55 'cdf_name' : [] 56 }57class Cdf_InstitutionFilter(FilterSet):58 Field.register_lookup(NotEqual)59 #Field.register_lookup(NotIn)60 class Meta:61 model = Cdf_Institution62 fields = {63 #filters:'exact','ne', 'lt', 'gt', 'lte', 'gte', 'in', icontains64 'id': ['exact', 'ne', 'in'], #notin65 'name' : ['exact', 'ne', 'icontains'],66 'inst_id' : ['exact', 'in']67 }68class ParameterFilter(FilterSet):69 Field.register_lookup(NotEqual)70 #Field.register_lookup(NotIn)71 class Meta:72 model = Parameter73 fields = {74 #filters:'exact','ne', 'lt', 'gt', 'lte', 'gte', 'in', icontains75 'id': ['exact', 'ne', 'in'], #notin76 'pname': ['exact', 'ne', 'in', 'icontains'], #notin77 'unit': ['exact', 'ne', 'in', 'icontains'], #notin78 'long_name': ['icontains'], 79 'stand_name': ['exact', 'ne', 'in', 'icontains'], #notin 80 'fval_qc': [], 81 'fval': [], 82 'category_long': ['exact', 'ne', 'in', 'icontains'], #notin83 'category_short': ['exact', 'ne', 'in', 'icontains'], #notin84 }85class FerryboxFilter(FilterSet):86 Field.register_lookup(NotEqual)87 #Field.register_lookup(NotIn)88 class Meta:89 model = Ferrybox90 fields = {91 #filters:'exact','ne', 'lt', 'gt', 'lte', 'gte', 'in', icontains92 'id': ['exact', 'ne', 'in'], #notin93 'dt': ['lt', 'gt', 'lte', 'gte', 'icontains'],94 'lat': ['lt', 'gt', 'lte', 'gte'],95 'lon': ['lt', 'gt', 'lte', 'gte'],96 'posqc': ['exact', 'ne', 'in','lt', 'gt', 'lte', 'gte'], #notin97 'pres': ['lt', 'gt', 'lte', 'gte'],98 'presqc': ['exact', 'ne', 'in', 'lt', 'gt', 'lte', 'gte'], #notin99 'param': ['exact'],100 'param__id' : ['exact','ne', 'in'], #notin101 'val': ['lt', 'gt', 'lte', 'gte'],102 'valqc': ['exact', 'ne', 'in', 'lt', 'gt', 'lte', 'gte'], #notin103 'route_id': ['exact'],...
filter_dict.py
Source:filter_dict.py
1filters = {2 'assets': {3 'id': {'operators': ['equals', 'like', 'in', 'notIn']},4 'name': {'operators': ['equals', 'like', 'in', 'notIn']},5 'first_seen': {'name': 'firstSeen', 'operators': ['equals', 'like', 'in', 'less', 'greater', 'notIn']},6 'last_seen': {'name': 'lastSeen', 'operators': ['equals', 'like', 'in', 'less', 'greater', 'notIn']},7 'addresses': {'operators': ['contains', 'like', 'notIn']},8 'direct_addresses': {'name': 'directAddresses', 'operators': ['contains', 'like', 'notIn']},9 'type': {'operators': ['equals', 'like', 'in', 'notIn']},10 'purdue_level': {'name': 'purdueLevel', 'operators': ['equals', 'like', 'in', 'notIn']},11 'vendor': {'operators': ['equals', 'like', 'in', 'notIn']},12 'run_status': {'name': 'runStatus', 'operators': ['equals', 'like', 'in', 'notIn']},13 'runStatusTime': {'operators': ['equals', 'like', 'in', 'less', 'greater', 'notIn']},14 'location': {'operators': ['equals', 'like', 'in', 'notIn']},15 'description': {'operators': ['equals', 'like', 'in', 'notIn']},16 'os': {'operators': ['equals', 'like', 'in', 'notIn']},17 'family': {'operators': ['equals', 'like', 'in', 'notIn']},18 'modelName': {'operators': ['equals', 'like', 'in', 'notIn']},19 'firmware': {'operators': ['equals', 'like', 'in', 'notIn']},20 'slot': {'operators': ['equals', 'like', 'in', 'less', 'greater', 'notIn']},21 'backplane': {'operators': ['equals', 'like', 'in', 'notIn']},22 'risk': {'operators': ['equals', 'like', 'in', 'less', 'greater', 'notIn']},23 'criticality': {'operators': ['equals', 'like', 'in', 'less', 'greater', 'notIn']},24 'site': {'operators': ['equals', 'like', 'in', 'notIn']},25 'hidden': {'operators': ['equals', 'like', 'in', 'notIn']},26 'customField1': {'operators': ['equals', 'like', 'in', 'notIn']},27 'customField2': {'operators': ['equals', 'like', 'in', 'notIn']},28 'customField3': {'operators': ['equals', 'like', 'in', 'notIn']},29 'customField4': {'operators': ['equals', 'like', 'in', 'notIn']},30 'customField5': {'operators': ['equals', 'like', 'in', 'notIn']},31 'customField6': {'operators': ['equals', 'like', 'in', 'notIn']},32 'customField7': {'operators': ['equals', 'like', 'in', 'notIn']},33 'customField8': {'operators': ['equals', 'like', 'in', 'notIn']},34 'customField9': {'operators': ['equals', 'like', 'in', 'notIn']},35 'customField10': {'operators': ['equals', 'like', 'in', 'notIn']},36 }...
temp.py
Source:temp.py
1# -*- coding: utf-8 -*-2"""34"""56'''71. å
æ两个表(old1,old2)å并, 82. ç¶åååºéå¤çæ°æ®, ä¿çä¸æ¡93. ä¿åå°æ°è¡¨new1104. å§old1表ånew1表å并115. ç¶åååºéå¤çæ°æ®å¹¶å é¤ï¼å¾å°å·®éï¼å°±æ¯å¨old2ä¸ä½ä¸å¨old1ä¸çæ°æ®126. å§old2表ånew1表å并137. ç¶åååºéå¤çæ°æ®å¹¶å é¤ï¼å¾å°å·®éï¼å°±æ¯å¨old1ä¸ä½ä¸å¨old2ä¸çæ°æ®14'''151617import pandas as pd181920# openexcel21data1 = pd.read_excel('C:\\Users\\JZ\\.spyder-py3\\1.xlsx')22df1 = data1['Server Name'] # 读ååå为Server Nameçå
容23#print(df1)2425data2 = pd.read_excel('C:\\Users\\JZ\\.spyder-py3\\2.xlsx')26df2 = data2['Host'] # 读ååå为Hostçå
容27#print(df2)282930# 1.merge_excel31res = pd.concat([df1, df2], axis=0, ignore_index=True)32#print(res)333435# 2,3.get_compilation36#compilation_del = res.drop_duplicates(keep=False)37compilation = res.drop_duplicates()38compilation.to_excel('C:\\Users\\JZ\\.spyder-py3\\res.xlsx')39#print(compilation_del)40#print(compilation)4142# 4.merge ITAM and compilation43notin_df1_file = pd.concat([df1, compilation], axis=0, ignore_index=True)44#print(notin_df1_file)4546# 5.get subtraction47inventory_notin_itam = notin_df1_file.drop_duplicates(keep=False)48#print(inventory_notin_itam)49inventory_notin_itam.to_excel('C:\\Users\\JZ\\.spyder-py3\\inventory_notin_itam.xlsx')5051# 6.merge inventory and compilation52notin_df2_file = pd.concat([df2, compilation],axis=0, ignore_index=True)53#print(notin_df2_file)5455# 7.get subtraction56itam_notin_inventory = notin_df2_file.drop_duplicates(keep=False)57#print(itam_notin_inventory)58itam_notin_inventory.to_excel('C:\\Users\\JZ\\.spyder-py3\\itam_notin_inventory.xlsx')596061626364
...
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!!