Collect matching elements of a python List from Dictionary keys – Python

Hi, I am trying to write a script/function for this problem but I am no where close. Any help regarding with the script is very much appreciated. I am new to python, and I am using python 2.7. (Script in pandas also works)

I have two csv files. File1 - Contains two columns, 'Name' and 'Category'.

Apple, Fruit
Pineapple, Fruit

File2 - Contains a single column 'Name'

banana 3 oz
Apple 2 oz
Pineapple 4
spinach 40 oz
Apple Lot
Pineapple Salad

step 1 – I need read these two files – which I am able to do.
Assuming I should read the first file and store the values in a dictionary and second file values in a python list

file_1: {‘Apple’:(‘Fruit’,’breakfast’,’juice’), ‘Pineapple’: (‘Fruit’,’breakfast’,’juice’), ‘spinach’:(‘juice’,’lunch’,’dressing)

file_2 : (banana 3 oz,Apple 2 oz,Pineapple 4,spinach 40 oz,Apple Lot,Pineapple Salad)

step 2 – I need to collect the matching elements of the list from a dictionary keys (i.e., Apple, Pineapple,Spinach)
step 3 – then create a dictionary with the matching list elements and the matching dictionary values
(i.e., Apple 2 oz,Pineapple 4,spinach 40 oz,Apple Lot,Pineapple Salad)

Finaloutput: {'Apple 2 oz': ('Fruit','breakfast','juice'), 'Apple Lot':('Fruit','breakfast','juice'), 'Pineapple 4':('Fruit','breakfast','juice'), 'Pineapple Salad' :('Fruit','breakfast','juice'), 'spinach 40 oz' : ('juice','lunch','dressing)}

I need to write the final output into a csv file in this following format.

Apple 2 oz,Fruit
Apple 2 oz,breakfast
Apple 2 oz,Juice
Pineapple 4,Fruit
Pineapple 4,breakfast
Pineapple 4,Juice
spinach 40 oz,juice
spinach 40 oz,lunch
spinach 40 oz,dressing
Apple Lot,Fruit
Apple Lot,breakfast
Apple Lot,Juice
Pineapple Salad,Fruit
Pineapple Salad,breakfast
Pineapple Salad,Juice

Thanks a lot once again.

I will do internet research for collect contact information for $20

I will do internet research for collect contact information

I will perform deep online research on anything you’d like to know more about.

I know that you don’t have the time so I am here for you.

  • Scrape online directory to build business leads from YP, Yelp, Manta, Bloomberg etc.
  • Scrape product information from eCommerce stores like Amazon, Aliexpress, Alibaba, Walmart.
  • Build a list of schools, doctors, stores
  • Movie information and ratings
  • Weather and stock exchange rates
  • And many many more as per your requirement

Here’s the kind of information that I can find for you(Please note that only limited research is done for the basic gig)

  • Company contact details i.e. name, URL, mailing address, phone, general or contact person e m ail
  • Market research
  • Product list
  • Keywords research
  • competition analysis
  • Surveys
  • Statistical data
  • Industry, Product lists and eCommerce research
  • Analysis, comparison, report or statistical data find

    Real estate or Property data look-up
  • Legal or medical search
  • Niche related content i.e. blogs, article 

Feel free to submit an order. I will deliver you the results in an Excel Spreadsheet, CSV, JSON or whatever format you prefer.


File host where one can collect points, what can be redeemed to premium coupons? | Proxies-free

I would like to try a file hoster, where I get points for the downloads, and then a certain amount of points can be redeemed to premium coupons. Then I would be able to either sell the coupons, or post them as giveaways on my blog, or forums. Lucky visitors can use the premium coupons to get premium membership on the file host without paying, and enjoy premium download speed, no captchas, etc. or implement such a point system. Any other file hoster besides them?


security – Is Microsoft Forms adequately secure to collect personal health information?

I want to make a survey on a website using Microsoft Forms. Patients would input personal health information into this form, so I want it to be secure.

The Microsoft website indicates that Microsoft Forms is HIPAA and BAA compliant, which sounds great; however, when I dig deeper, I don’t really find what I want to see in plain English.

Can information submitted over Microsoft Forms be read by someone other than me, the website owner?

dnd 5e – How can we create someone’s head (after the original was eaten by sharks) to collect their bounty?

Last night, we boarded a pirate ship to collect 500g for its captain’s head. The Paladin, being a clever Shield Master boy, shoved him off the edge of the ship for the giant sharks in the water to take care of. After we cleaned up the rest of the crew, we Polymorphed the Paladin to go get the corpse back.

Problem is, we only found the gem-riddled cloak and scimitar the captain was wielding, and bits of his body (a hand and a leg). The rest of him, the sharks got. We need his head to collect his bounty. What options do we have, as a level 13 party with a Vengeance Paladin, Necromancer Wizard, Storm Sorcerer, Samurai Fighter, and Shadow/Chain SorcLock?

We thought we could Resurrect the dude, kill him again, and voilá, we had his dead. But that is not very lucrative to do.

Expression manipulation – Apply the function to coefficients and variables in Collect

I am concerned with form expressions

expr = c(1) G(1) + c(3,8) G(3,8) + ... + c(3) G(1) + ... 

where the Gs are fixed objects and the cs are some untidy coefficients. I want to collect this term term by term in the GS and get some of the form

Sum(d(i__) G(i__), {i, some_set})

and then perform operations on both the ds and the gs. If I just wanted to do something with the ds, I think

Collect(expr, G(__), operation_d)

would be the most suitable and probably the most efficient function. Is there a (built-in) way to trade? at the same time also on the Gs? I think the process necessarily contains all the necessary data during the collection process.

Of course I can create a list of the relevant Gs (Collect (expr, G (__), 1 &)) and a list of the corresponding coefficients, then act on them and combine them again. However, this splits the problem into two parts externally rather than internally, and in the event that only Collect () can be handled in one step, this is definitely less efficient. I'm basically wondering if there's anything more "math" to do. Thank you so much!

Note: I am familiar with the related, but not identical, five year old question of how to organize the expression through symbols (like collecting) but apply different functions to each coefficient.