Exclude a value from AVG in SQL

I have a table where i have to find the avg price of an item, the problem is that i have to exclude a payment option from the avg lets say the table goes like this Example I want to remove cash payments from this avg >Solution : Just add a WHERE statement to filter… Read More Exclude a value from AVG in SQL

pandas multIndex from product – ignore same row comparison

I have a pandas dataframe like as shown below Company,year T123 Inc Ltd,1990 T124 PVT ltd,1991 ABC Limited,1992 ABCDE Ltd,1994 tf = pd.read_clipboard(sep=’,’) tf[‘Company_copy’] = tf[‘Company’] I would like to compare each value from tf[‘company’] against each value of tf[‘company_copy] but exclude same matching row number or index number, string For ex: I want T123… Read More pandas multIndex from product – ignore same row comparison

Pandas – Filter based on multiple conditions

I am facing a problem when I need to exclude some rows from by dataframe. here the code: import numpy as np import pandas as pd dff = { ‘ID’: [1, 2, 3, 4, 5, 6, 7], ‘Default’: [1,1,0,1,0,1,0], ‘Default_Amount’: [1200,2000,0,350,0,760,0], ‘Tot_Amount’: [1200,2000,3400,350,10000,760,7500], ‘Time’ : [‘October’,’March’,’November’,’November’,’January’,’December’,’January’], ‘Class’: [‘A’,’B’,’A’,’A’,’B’,’B’,’A’] } dff = pd.DataFrame(dff) display(dff) dff[(dff.Time !=… Read More Pandas – Filter based on multiple conditions

Laravel Getting id's from a table and inserting them into another table

Trying to get matching id’s from a table and inserting them again in the same table under differnet relationship. $contentPack = ContentPack::find($id); $cloned_pack_goals = DB::table(‘content_pack_goal’)->where(‘content_pack_id’ , $contentPack->id)->get(); $cloned_pack_goal_ids = $cloned_pack_goals->goal_id; Produces Exception Exception Property [goal_id] does not exist on this collection instance. dd($cloned_pack_goals); outputs: Illuminate\Support\Collection {#2466 ▼ #items: array:2 [▼ 0 => {#3129 ▼ +"goal_id":… Read More Laravel Getting id's from a table and inserting them into another table

How to exclude some text between two patterns?

I’d like to match all patterns between <PDF> and </PDF> inside a string: import re lines = """ hello <PDF> bla1 </PDF> test <PDF> bla2 </PDF> """ matches = re.findall(r"<PDF>.*</PDF>", lines, re.DOTALL) print(matches) Output: [‘<PDF>\nbla1\n</PDF>\ntest\n<PDF>\nbla2\n</PDF>’] Expected Output: [‘<PDF>\nbla1\n</PDF>’, ‘<PDF>\nbla2\n</PDF>’] What’s going wrong here? How can I ensure that no text between </PDF> and <PDF> gets… Read More How to exclude some text between two patterns?