Categories
Development

Displaying all the members of database in Prolog

I’m trying to make a predicate “find_recipe” which fetches a list of ingredients based on the name of the recipe, given by the user. I defined 3 recipes and am trying to first show a prompt for a user, let the user enter the recipe name, and then next few lines which are commented out […]

Categories
Development

count items across all columns using pandas method

I have this dataframe and I can get the count of each item per row using vectorizer. But this works correctly for single row (for e.g. col1). How do I apply it to entire dataframe (all 3 columns)? import pandas as pd import numpy as np from sklearn.feature_extraction.text import CountVectorizer shopping_list = [ [“Apple”, “Bread”, […]

Categories
Development

How can I get the median value of each product in Postgresql?

I have one table named ‘sales’. create table sales ( cust varchar(20), prod varchar(20), day integer, month integer, year integer, state char(2), quant integer ); insert into sales values (‘Bloom’, ‘Pepsi’, 2, 12, 2001, ‘NY’, 4232); insert into sales values (‘Knuth’, ‘Bread’, 23, 5, 2005, ‘PA’, 4167); insert into sales values (‘Emily’, ‘Pepsi’, 22, 1, […]

Categories
CSV Development

I have items list in the excel (csv file) that i would like to have sum of all items and how many times it shows in the whole items list [on hold]

basically i want to do this in python: input: my_file.csv person,items,,,, A,apple, candy, banana,pasta, milk B,banana, chocolate, milk, pizza, candy C,pasta, candy, apple, milk, chocolate output: items: apple–> 2 candy–> 3 banana–> 2 milk–> 3 pasta –> 2 chocolate –> 2 pizza–> 1 Can someone please suggest easiest way to do these items counts (adding […]

Categories
Development

Maintain insert order from a tuple and count k(3) unique paths/products

While preparing for an interview I saw the following question as follows: Following tuple is given as input, where first element is CustomerID and second element is ProductID. We need to find the output as consecutive longest in order sequence of ProductID which every customer buys. Input: [(‘A’,’Milk’), (‘B’,’Milk’), (‘A’,’Apples’), (‘A’,’Coffee’), (‘B’,’Apples’),(‘C’,’Apples’), (‘B’,’Coffee’), (‘A’,’Vegetable’), (‘B’, […]

Categories
Development Django

Design django Relation to save data easily later

I have 2 csv’s according to which I have to design database. first one is And my 2nd csv is And My django model code till now is class Restaurant(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) image = models.ImageField(null=True, upload_to=’Restaurant’) RestaurantName = models.CharField(max_length=50, null=False, blank=False) Location = models.TextField(max_length=100, null=False) Logo = models.ImageField(null=True, upload_to=’Logo’) NumberOfTables=models.IntegerField(default=0) Availability=models.CharField(max_length=100 , choices=Availability_CHOICES […]

Categories
Ask Diet & Fitness

[ Diet & Fitness ] Open Question : Eating just meat and fruits?

I was thinking about changing my diet to eating purely meat and fruits, cut out soda and alcohol for water, milk, or juices like oj. Will this be totally fine or would I have some kind of deficiency or side effect? From what I see, the meat provides protein and the fruits provide other vitamins […]

Categories
Ask

[ Non-Alcoholic Drinks ] Open Question : Are there any Americans that ONLY drink water when they want something to drink? That means NO tea, No coffee, no juice, no soda, no?

milk, no smoothies, no liquor, etc. NOTHING BUT WATER. Please explain.

Categories
Development

Why can’t I concatenate correctly is an adjacent cell value is true?

I am trying to concatenate text together if the adjacent cell value is “True”. I have written code that allows works for all the text in the cells but I can’t seem to piece together working code using an if statement. The table begins on B6 and looks like this: True Butter False Cream False […]