4k67d 5resk bider net68 7zdkh dny6b fzrbt t682i h4zn8 b4bzy 9tfd6 rffab ih33i ffed6 snzd4 tesz5 byih3 d37k3 8z9zi i5tr8 n8i9a Python help |

Python help

2022.01.21 13:44 HairNo5183 Python help

Hello everyone,
i have a python assignment and i get stuck just every step of the way. This coding assignment is a big deal for the class i am taking and i really want to be able to hand it in...
Thank you for your time!

The assignment looks like this:

1. read tfidf matrix. A csv file containing test data comes with the assignment (stories.csv, "stories" collection). It contains the tfidf matrix from three stories (the documents) plus one document-query. The document stories_solution.xlsx contains the calculation of steps 2, 3, and 4 as an example for you to study. Note that all input is treated as text by csv.reader, while numbers need to be converted to float. The resulting data structure is a list of lists, as in the example below ['term', 'd_01_greedog.txt', 'd_02_obstgoat.txt', 'd_03_peace.txt', 'q_imagine_song.txt'] ['cindy', '0', '0', '2.0', '0'] ['joy', '0', '0', '2.0', '0'] ['west', '0', '0', '2.0', '0'] ['augusta', '0', '0', '2.0', '0'] ['va', '0', '0', '2.0', '0'] ['peace', '0.41503749927884376', '0', '0.41503749927884376', '0.41503749927884376'] ['song', '0', '0', '2.0', '0'] ['last', '0', '0', '2.0', '0'] ['nite', '0', '0', '2.0', '0'] ['strangest', '0', '0', '2.0', '0'] ['dream', '0', '0', '2.0', '0'] ['never', '1.0', '0', '2.0', '0'] ['dreamed', '0', '0', '6.0', '0'] ['world', '0', '0', '1.0', '3.0'] ['agreed', '0', '0', '2.0', '0'] ['put', '0', '0', '2.0', '0'] ['end', '0', '0', '2.0', '0'] ['war', '0', '0', '2.0', '0'] ['saw', '1.0', '0', '1.0', '0'] ['mighty', '0', '0', '2.0', '0'] ['room', '0', '0', '2.0', '0'] ['filled', '0', '0', '2.0', '0'] ['women', '0', '0', '2.0', '0'] ['men', '0', '0', '2.0', '0'] ['paper', '0', '0', '4.0', '0'] ['signing', '0', '0', '2.0', '0'] ['said', '0', '0', '2.0', '0'] ['fight', '0', '1.0', '1.0', '0'] ['signed', '0', '0', '2.0', '0'] ['million', '0', '0', '2.0', '0'] ['copies', '0', '0', '2.0', '0'] ['made', '0', '0', '2.0', '0'] ['joined', '0', '0', '2.0', '0'] ['hands', '0', '0', '2.0', '0'] ['bowed', '0', '0', '2.0', '0'] ['heads', '0', '0', '2.0', '0'] ['grateful', '0', '0', '2.0', '0'] ['prayers', '0', '0', '2.0', '0'] ['prayed', '0', '0', '2.0', '0'] ['people', '0', '0', '1.0', '3.0'] ['streets', '0', '0', '2.0', '0'] ['dancing', '0', '0', '2.0', '0'] ['round', '0', '0', '4.0', '0'] ['guns', '0', '0', '2.0', '0'] ['swords', '0', '0', '2.0', '0'] ['uniforms', '0', '0', '2.0', '0'] ['scattered', '0', '0', '2.0', '0'] ['ground', '0', '0', '2.0', '0'] ['imagine', '0', '0', '0', '14.0'] ['heaven', '0', '0', '0', '2.0'] ['easy', '0', '0', '0', '2.0'] ['try', '0', '0', '0', '2.0'] ['hell', '0', '0', '0', '2.0'] ['us', '0', '0', '0', '8.0'] ['sky', '0', '0', '0', '2.0'] ['living', '0', '0', '0', '4.0'] ['today', '0', '0', '0', '2.0'] ['countries', '0', '0', '0', '2.0'] ['hard', '0', '0', '0', '2.0'] ['nothing', '1.0', '0', '0', '1.0'] ['kill', '0', '0', '0', '2.0'] ['die', '0', '0', '0', '2.0'] ['religion', '0', '0', '0', '2.0'] ['life', '0', '0', '0', '2.0'] ['may', '0', '0', '0', '4.0'] ['say', '0', '0', '0', '4.0'] ['dreamer', '0', '0', '0', '4.0'] ['one', '0', '1.0', '0', '4.0'] ['hope', '0', '0', '0', '4.0'] ['someday', '0', '0', '0', '4.0'] ['join', '0', '1.0', '0', '2.0'] ['possessions', '0', '0', '0', '2.0'] ['wonder', '0', '0', '0', '2.0'] ['need', '0', '0', '0', '2.0'] ['greed', '0', '0', '0', '2.0'] ['hunger', '0', '0', '0', '2.0'] ['brotherhood', '0', '0', '0', '2.0'] ['man', '0', '0', '0', '2.0'] ['sharing', '0', '0', '0', '2.0'] ['live', '0', '0', '0', '2.0'] ['greedy', '4.0', '0', '0', '0'] ['dog', '14.0', '0', '0', '0'] ['upon', '1.0', '1.0', '0', '0'] ['time', '1.0', '1.0', '0', '0'] ['managed', '2.0', '0', '0', '0'] ['steal', '2.0', '0', '0', '0'] ['large', '2.0', '1.0', '0', '0'] ['steak', '8.0', '0', '0', '0'] ['butcher', '2.0', '0', '0', '0'] ['shop', '2.0', '0', '0', '0'] ['ran', '2.0', '0', '0', '0'] ['woods', '2.0', '0', '0', '0'] ['eat', '2.0', '0', '0', '0'] ['reaching', '2.0', '0', '0', '0'] ['banks', '1.0', '1.0', '0', '0'] ['stream', '4.0', '0', '0', '0'] ['happened', '1.0', '1.0', '0', '0'] ['see', '4.0', '0', '0', '0'] ['face', '2.0', '0', '0', '0'] ['reflected', '2.0', '0', '0', '0'] ['water', '4.0', '0', '0', '0'] ['moment', '2.0', '0', '0', '0'] ['thinking', '2.0', '0', '0', '0'] ['looking', '2.0', '0', '0', '0'] ['thought', '2.0', '0', '0', '0'] ['another', '2.0', '0', '0', '0'] ['holding', '2.0', '0', '0', '0'] ['mouth', '2.0', '0', '0', '0'] ['jumped', '2.0', '0', '0', '0'] ['snatch', '2.0', '0', '0', '0'] ['meat', '4.0', '0', '0', '0'] ['course', '2.0', '0', '0', '0'] ['reflection', '2.0', '0', '0', '0'] ['vanished', '2.0', '0', '0', '0'] ['could', '4.0', '0', '0', '0'] ['sign', '2.0', '0', '0', '0'] ['realize', '2.0', '0', '0', '0'] ['barked', '2.0', '0', '0', '0'] ['frighten', '2.0', '0', '0', '0'] ['dropped', '2.0', '0', '0', '0'] ['stolen', '2.0', '0', '0', '0'] ['unluckily', '2.0', '0', '0', '0'] ['current', '2.0', '0', '0', '0'] ['swift', '2.0', '0', '0', '0'] ['carried', '2.0', '0', '0', '0'] ['away', '2.0', '0', '0', '0'] ['though', '2.0', '0', '0', '0'] ['hunted', '2.0', '0', '0', '0'] ['find', '2.0', '0', '0', '0'] ['trace', '2.0', '0', '0', '0'] ['meant', '2.0', '0', '0', '0'] ['instead', '2.0', '0', '0', '0'] ['two', '1.0', '2.0', '0', '0'] ['steaks', '2.0', '0', '0', '0'] ['left', '2.0', '0', '0', '0'] ['obstinate', '0', '2.0', '0', '0'] ['goats', '0', '8.0', '0', '0'] ['mountain', '0', '4.0', '0', '0'] ['going', '0', '2.0', '0', '0'] ['opposite', '0', '2.0', '0', '0'] ['slopes', '0', '2.0', '0', '0'] ['valley', '0', '2.0', '0', '0'] ['flowed', '0', '2.0', '0', '0'] ['rushing', '0', '2.0', '0', '0'] ['river', '0', '6.0', '0', '0'] ['dwellers', '0', '2.0', '0', '0'] ['bridged', '0', '2.0', '0', '0'] ['placing', '0', '2.0', '0', '0'] ['tree', '0', '6.0', '0', '0'] ['trunk', '0', '8.0', '0', '0'] ['struck', '0', '2.0', '0', '0'] ['lightning', '0', '2.0', '0', '0'] ['steep', '0', '2.0', '0', '0'] ['rocky', '0', '2.0', '0', '0'] ['met', '0', '2.0', '0', '0'] ['head', '0', '2.0', '0', '0'] ['half', '0', '2.0', '0', '0'] ['way', '0', '4.0', '0', '0'] ['across', '0', '2.0', '0', '0'] ['wanted', '0', '2.0', '0', '0'] ['cross', '0', '2.0', '0', '0'] ['side', '0', '2.0', '0', '0'] ['nearly', '0', '2.0', '0', '0'] ['wide', '0', '2.0', '0', '0'] ['enough', '0', '4.0', '0', '0'] ['pass', '0', '4.0', '0', '0'] ['neither', '0', '4.0', '0', '0'] ['goat', '0', '2.0', '0', '0'] ['inclined', '0', '2.0', '0', '0'] ['give', '0', '2.0', '0', '0'] ['obstinately', '0', '2.0', '0', '0'] ['began', '0', '2.0', '0', '0'] ['bicker', '0', '2.0', '0', '0'] ['would', '0', '4.0', '0', '0'] ['budge', '0', '2.0', '0', '0'] ['inch', '0', '2.0', '0', '0'] ['words', '0', '2.0', '0', '0'] ['soon', '0', '2.0', '0', '0'] ['led', '0', '2.0', '0', '0'] ['action', '0', '2.0', '0', '0'] ['started', '0', '2.0', '0', '0'] ['till', '0', '2.0', '0', '0'] ['finally', '0', '2.0', '0', '0'] ['tumbled', '0', '2.0', '0', '0'] ['much', '0', '2.0', '0', '0'] ['simpler', '0', '2.0', '0', '0'] ['courteous', '0', '2.0', '0', '0'] ['allow', '0', '2.0', '0', '0'] 
What i get stuck on here is that i can't figure out how to convert the string numbers from the csv file to floats. I have tried to take the second, third, fourth and fifth entry from each list and convert those to floats (if they arent specifically the strings from the first list) but then when i print the whole list it doesn't print the text from the first list. Here is the code i tried:
import csv csv_file = open("stories.csv", "r") csvlijst = csv.reader(csv_file) for row in csvlijst: print(row) if row[1] != "d_01_greedog.txt": row[1] = float(row[1]) if row[2] != "d_02_obstgoat.txt": row[2] = float(row[2]) if row[3] != "d_03_peace.txt": row[3] = float(row[3]) if row[4] != "q_imagine_song.txt": row[4] = float(row[4]) csv_file.close() 
Obviously this doesn't work but i don't know a better way to do it
2. calculate document vector lengths. Calculate the length of each document vector + document-query vector by means of the following equation 
https://i.imgur.com/f1s4GI6.png (here is a link to a picture of the equation)
What i get stuck on here is how i do the equation in python, i know its pretty stupid and a basic thing to do. If i could get the first assignment right i would search online for how to implement certain equations in python code and use variables that have the values of the values i get from the first assignment but i don't know if it would be that simple

If i can get these first two assignments right im sure i can understand the rest of the assignment too since those are similair to these two. I hope someone is able to help me or give me tips on how i should approach this.
Thank you so much for your time!
submitted by HairNo5183 to learnpython [link] [comments]


2022.01.21 13:44 LethalLephty I Was Near a triple homicide

Long Post
My sis and I were on the subject of the guy in my hometown that went on a short killing spree. And she brought this story up I told when it happened.
About 8yrs ago I stayed downtown. Back then if you remember Craigslist had a 'Personals' section. I never really dabbled in that, but being curious I did. So I made an ad--nothing spectacular and waited. Not much went down; just some scammers and bots, married people, etc. I get this one message from a young woman telling me how I sound interesting and would love to get to know me more. We exchanged pics. She exchanged an older pic but she looked pretty cute in it. Had a bright smile and big blue eyes. She was nice I just wasn't feeling her like that. She was 18 and I was 24 at the time. But also, she was 7 months pregnant.
We enjoyed conversations for a few days and we decided to link. She didn't stay far from me. She stayed more on the northeast side just on the edge of downtown. This day it was a festival going on. I asked if she wanted to go but she couldn't because her legs were tired and kinda sore. So I agreed to meet her at her place. She stayed in a northern slum. Not ghetto, but slum. The house was big but also you could tell off bat that it was used as an apartment. Wasn't an appealing house but there weren't many other appealing ones either.
When I told her I'm outside, I see her come on the front porch. She was a small thing. All of about 5'0" tall. White with dark hair. Couldn't be no more than 90-110lbs and that was because of the pregnancy. Her baby bump was very noticeable. She had a small, chocolate labrador puppy with her. They both were happy to see me. When I got close to her I was surprised. She didn't have the same bright smile I saw in her pics. Her teeth were gray and her face looked liked someone who was into heavy drugs. Her eyes still had light to them. But overall she looked like a tired human being (and not in the fatigued sense).
I gave her a hug--made sure to watch my strength. We went into the place. There wasn't nothing sketchy about it. It stunk. Like animals and weed. We went upstairs and I saw a black couple up there. They shut their door and it seemed like they were arguing. All the rooms upstairs seemed small and the ceilings were slanted. Her room was fitted pretty nice. She was a smoker I smelled the ashtray stench.
We decided to watch Pineapple Express. That was my first time seeing that movie. She complained about her legs a lot. I seen some little swelling on them so I gave her legs a rub. I used her body lotion. She loved it a lot and appreciated it big time.
We talked, and it was getting late and I wanted to head out to downtown and catch the heat of the festivities. She looked like she enjoyed my company a lot and as we were waving goodbye for some reason I just said to myself, "Man that chick seems troubled." I thought of burning sage when I got home.
Like two days later she hit me up saying her ex BF got kicked out of his place and he needed somewhere to stay. So me and her hanging out couldn't happen again. Which I didn't care I just told her I understood and make sure she's safe.
I left to Chicago to spend time with family. I came back a week later and after getting my hair retwisted I saw a realty sign with her last name on it when I was out for a walk. She had a unique last name. I decided to check on her. I sent her an email. No response. About 5mins later I open up Facebook and as I scrolled I stopped immediately, because I saw the very picture she first sent me. I'm like, why the hell is THAT pic on here? I click a link saying there was a triple homicide! I sat on the curb and was shocked. I couldn't believe it. I read the details and was shocked.
She met a guy on Craigslist for sex. Her ex met up with him too supposedly. He killed the ex BF and decapitated him. Left his body at a park I was familiar with. He took her and held her captive in his basement. He tortured her for a week. What made me so pissed was that he went to a sports bar down the street from me and TOLD the bartenders how he has someone locked up in his basement right now. Nobody took it serious to call the police. That probably could've saved her. He strangled her and stuffed her in a suitcase. By then the police figured him out and he was on the run. When they stopped his car, he decided to take himself out.
They found him probably because of the emails from Craigslist. I know they investigated my email. I deleted it immediately once I took all this in.
About a month later, I was on Craigslist and I saw in the miscellaneous section about meeting scammers and such. I posted a reply about people being careful and I posted her story. Also, around then I had a guy I went to HS with who got caught robbing people for money on there. When I summarized her story I get a reply. It was from a lady demanding to know what I know. Come to find out it was her aunt. When I told her she wanted to talk on the phone so I did. I gave her my condolences and told her about the time we spent together. She told me her ex was pimping her out. Her life never was like that. Her parents were good people and confused that she took that path in life.
That girl was just a baby. I've been around death before but nothing like that. Because what if I kept hanging with her? The crazier parts are, the guy had another woman in his place, but she escaped. She was living with him and he made her a sex slave. But also, he was supposed to fly to Vegas to meet a lady for from a fetish site. But there were complications on his end. The day he committed the murder he contacted the lady and told her he wanted to meet her ASAP. He was paying for the travel and everything but she needed his info. She didn't go through with it, but she looked him up and happen to see his connection with a triple homicide.
What's even more dark is that they didn't find her ex BFs head at the park. Just his body. They found his head north of the city in 2019. Like 25 miles away from his dead body. Why did he take that head? What he do with it to travel with it like that?
The awkward thing is that there was a lady who lived with me a year later after that. Things were complicated and I had to kick her out. She moved into the exact room that chick was in. I know because I had to come over there to give her something she left. This is also the girl that played a major part in my sister and her ex BF breaking up, for good. People do come into your life for a reason I suppose.
I used Craigslist for business and some social events. But after that my approach became entirely different. And I became very cautious on who I met.
submitted by LethalLephty to creepyencounters [link] [comments]


2022.01.21 13:44 laczabetyar 3D printed parts for Kitain Cross Spear, Genshin Impact

3D printed parts for Kitain Cross Spear, Genshin Impact submitted by laczabetyar to cosplayprops [link] [comments]


2022.01.21 13:44 thehandsomebog [WTB] left handed owb holster for g19x with TLR1 (tx)

Looking for a holster with belt clip or whatever it’s called. A plus it it comes with magazine attachments. Decent quality one around $80
submitted by thehandsomebog to GunAccessoriesForSale [link] [comments]


2022.01.21 13:44 elizzy256 I’m looking for someone I can spoil with everything and who’s also ready to spoil me with attention and loyalty

submitted by elizzy256 to SugarDaddyMeet_Sites [link] [comments]


2022.01.21 13:44 EveningSky3 This is my wip since one year!!! I've still have so much work to do but I'm very proud so I wanted to show it to you

This is my wip since one year!!! I've still have so much work to do but I'm very proud so I wanted to show it to you submitted by EveningSky3 to Embroidery [link] [comments]


2022.01.21 13:44 Particular-Donkey-67 You can buy stuff from this discord 100% legit I’ve already bought stuff and I can show proof that I did and also there is a review channel. Join and give it a shot

submitted by Particular-Donkey-67 to mandy [link] [comments]


2022.01.21 13:44 Adam_Velentzas There are some places that are just breathtaking

submitted by Adam_Velentzas to ffxiv [link] [comments]


2022.01.21 13:44 Yirmiria I just got denied a job

This is because I refuse to work weekends due to the fact it's my only time to see my Boyfriend and other family members. They work weekdays and have weekends off. They didn't even specify that they were looking for people to work weekends on their website. So that was a waste of time.
submitted by Yirmiria to antiwork [link] [comments]


2022.01.21 13:44 Taoggy The Cukeri Bells

The bells sound,
Not those of the priest,
But of the crowd of Cukeri,
Crying, calling and chanting.

They march beautifully
Across the town.
Pride flies in their eyes.
Their masks emanate light brighter than the sun.

At the End of the march,
They say their goodbyes,
They go home, take off the masks
And forget the light and the bells.
submitted by Taoggy to justpoetry [link] [comments]


2022.01.21 13:44 sploush Get 6 free stocks from MooMoo worth up to $3,500 each! Plus you’ll get an extra $45 $LCID stock guaranteed with my referral link! $100 min deposit required. Promo ends 1/31/22 [USA only]

Join MooMoo with my link and you can get 6 FREE stocks worth up $3,500 each! https://j.moomoo.com/00eYpS
Exclusive referral bonus: by using my link you will also get a guaranteed $LCID stock worth $45! $100 deposit required.
USA only!
submitted by sploush to cryptorefer [link] [comments]


2022.01.21 13:44 Super_Share_8721 Ego Death Got The Best Of Me. I Like The Stock!

Ego Death Got The Best Of Me. I Like The Stock! submitted by Super_Share_8721 to Superstonk [link] [comments]


2022.01.21 13:44 PVCnews Updated Expert RAW app comes to Samsung Galaxy S21 Ultra

Updated Expert RAW app comes to Samsung Galaxy S21 Ultra submitted by PVCnews to ProVideo [link] [comments]


2022.01.21 13:44 IAmTheEskimo Songs about life being good?

Just appreciating where you’re at in life and everything is great
submitted by IAmTheEskimo to poppunkers [link] [comments]


2022.01.21 13:44 kariiyoko miku pony

miku pony submitted by kariiyoko to mylittlepony [link] [comments]


2022.01.21 13:44 stefanosteve Here's a nugget from a few months ago

Here's a nugget from a few months ago submitted by stefanosteve to Planetside [link] [comments]


2022.01.21 13:44 AccomplishedAbroad22 Does any pregabalin users that take it prescriped by their GP also do recreational doses sometimes?

If so how much and how often. Would 600 mg once a month be a problem and also would i have any rebound anxiety the next day? I take 225 mg a day in 3 times
submitted by AccomplishedAbroad22 to gabagoodness [link] [comments]


2022.01.21 13:44 KrissieBeanie89 Water Temperature for Sunkist/Cherry Shrimp

Hi! I'm new here and new to having shrimp. I am struggling to figure out the best water temperature?
I had it on 75° but my fiancé convinced me to make it higher because it "would make them more active" do we have it at about 77° now. Is that okay? I have sunkist and cherry shrimpies. I love them.
submitted by KrissieBeanie89 to shrimptank [link] [comments]


2022.01.21 13:44 spookylatte Finally made STINGERS stickers!

Finally made STINGERS stickers! submitted by spookylatte to nostalgia [link] [comments]


2022.01.21 13:44 Bigguy2599 Lake Superior

Lake Superior submitted by Bigguy2599 to RockhoundExchange [link] [comments]


2022.01.21 13:44 Shadow-Doyler NEW SHINY METHOD! Pokemon Legends Arceus Shiny Update, News & Leak [OC]

NEW SHINY METHOD! Pokemon Legends Arceus Shiny Update, News & Leak [OC] submitted by Shadow-Doyler to LegendsArceus [link] [comments]


2022.01.21 13:44 E-X-Prime [H] Transformers and Various Legos [W] PayPal

Hello, thanks for checking out my post! I've got some odds and ends stuff I was hoping I could find a better home for. Everything listed is in good condition, and comes as is, no box or instructions included unless otherwise mentioned. If you want more pictures of any item listed and/or are interested in anything, send me a PM or chat. Thanks!
Robots in Disguise (2001): Autobot Brothers Powered-Up Lot - $20, https://imgur.com/a/2Gvovff

Unicron Trilogy Figures: https://imgur.com/a/i0aiLea
Generations Figures: https://imgur.com/a/2qxlTTU
Lego Overwatch Bastion 75974 - $55:
Lego Ninjago Legacy Spinners - $32 for all, individual prices below:
Lego Dimensions Packs - $40 for all, individual prices below:
submitted by E-X-Prime to toyexchange [link] [comments]


2022.01.21 13:44 Rough_Force Need some friends who know what its like

Any adult trans guys in the Denver, CO area looking for more friends? I would love to get to know some other guys in the area. I have been through my whole transition alone, and would love to be able to relate to some people.
Also random note, are we allowed to upload pictures to this sub? I can not figure out how, thanks!
submitted by Rough_Force to FTMMen [link] [comments]


2022.01.21 13:44 Tapil Virginia Karen threatens to bring loaded guns to her children's school if they enforce mask mandates. 01/20/2022, threat at 3 minute mark

Virginia Karen threatens to bring loaded guns to her children's school if they enforce mask mandates. 01/20/2022, threat at 3 minute mark submitted by Tapil to HamptonRoads [link] [comments]


2022.01.21 13:44 ionsawmill On a Stay-At-Home-Dad group I’m a member of. This was a comment on a post by a guy whose wife kept going through his phone.

On a Stay-At-Home-Dad group I’m a member of. This was a comment on a post by a guy whose wife kept going through his phone. submitted by ionsawmill to NotHowGirlsWork [link] [comments]


http://olegfocus.ru