NameError: name 'pd' is not defined - Part 2 - google-colaboratory

enter image description here
I have posted two different pictures for you to analyse:
1 - NameError: name 'pd' is not defined - Part 1(do you have to search in this website "stack overflow")
and
2 - NameError: name 'pd' is not defined - Part 2
Please give me some idea what could be the problem, if the system colaboratory that sometimes doesnt works properly or if I have to change the code(which I dont think be the problem).

I encountered same error but later found out that I was running the import command cell as Markdown and not as a Code. I corrected this and the error clears.

Related

unexpected indent python 3.7 pycharm

I am very new to python. But I want to extract some data of job postings from an online job portal.
With the following code I wanted to extract the title of the job posting of a particular website:
def jobtitle(soup):
jobs=[]
for div in soup.find_all(name="div", attrs={"class"}:"row"}):
for a in div.find_all(name="a",attrs={"data-tn-element":"jobTitle"}):
jobs.append(a["title"])
return(jobs)
jobtitle(soup)
I receive this error message:
for div in soup.find_all(name="div", attrs={"class"}:"row"}):
^
IndentationError: unexpected indent
I tried many different things that were recommend on other sites, but nothing worked. I just don't know what the problem is. I tried different whitespace, but I just don't understand what I am doing wrong.
Any ideas? I would be really grateful!
Thanks a lot :-)
Remove the indent on the first for line.
The first for statement should be directly under the jobs=[] declaration.
def jobtitle(soup):
jobs=[]
for div in soup.find_all(name="div", attrs={"class"}:"row"}):
for a in div.find_all(name="a",attrs={"data-tn-element":"jobTitle"}):
jobs.append(a["title"])
return(jobs)
jobtitle(soup)

pyspark gives error for describe() method when the column name as a '.' in it

I am importing data using pyspark dataframe from a csv file with header names have . in them e.g., x.name. It displays correctly. However, when I am trying to view its summary using describe method, I get an error - looks like whenever the column name has a . in it I have this error, else it works fine. Could someone please suggest how to resolve this?
I tried pandas and it works without any issues.
Thank you very much.
error

Sylius product show

I am using sylius e commerce and I have a problem about products.
Acctualy I created one products, and after that I tried to see my product on my shop so i cliked "Show in store" But after that I got an error, and I don't know how to solve it :(
I've been searching on google for solution and I've found it's possible to change
sylius.locale: en_US to en or smth like that but after I do that I still got error:
Catchable Fatal Error: Method Sylius\Component\Core\Model\Product::__toString() must return a string value
So I changed my locale back to en_US and after that I'm seeing this problem
Did you assign it to the default channel?
Go to administration/products/new, select Channel tab, check it, and save.

Getting reference from model One2many relationship comodel inside an ir.actions.act_window

Would like to ask on how you can get the id of the comodel inside the ir.actions.act_window.
See my source code: https://gist.github.com/renesansz/2642b02875475383605e
Currently, I cannot get the sprint_id.project_id.current_sprint reference since it's giving me an error of Uncaught Error: NameError: name 'sprint_id' is not defined. So what I wanted to happen is that upon opening the project it should add a default filter for the current sprint of the project.
Do I have any alternative for this kind of approach?
Tried doing domain, but still no luck solving the issue.
Try this: make related field and then use this field in xml view.

Can't find link using Mechanize follow_link()

I just starting looking at the Python version of Mechanize today. I took most of this code from the first example on http://wwwsearch.sourceforge.net/mechanize/. The documentation of this module is very sparse and I have no idea how to debug this.
I am trying to find and follow the first link with the text "Careers". When I run this I get this error "mechanize._mechanize.LinkNotFoundError". Can anyone tell me what I am doing wrong?
import re
import mechanize
br = mechanize.Browser(factory=mechanize.RobustFactory())
br.open("http://www.amazon.com/")
response1 = br.follow_link(text_regex=r"Careers", nr=1)
assert br.viewing_html()
print br.title()
I just tried the sample code myself, and it looks like the problem is with the nr argument. It's not documented anywhere but in the source code (which is far more informative than the documentation!), and it states that:
nr: matches the nth link that matches all other criteria (default 0)
Because the nr argument is 0-based, when you gave the argument of 1, it was looking for the second mention of Careers, which was obviously nothing.
Because it defaults to 0, or the first link found, you can set the nr argument to 0, or leave it off entirely.