Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Want to get email using pandas

import pandas as pd
df=pd.read_html('http://www.advpalata28.ru/reestr/reestr-advokatov/')

df[0].to_excel("link14.xlsx",encoding='utf-8')

I want to get email only from these text these is page link http://www.advpalata28.ru/reestr/reestr-advokatov/:

676740, Амурская обл, Архара пгт, Ленина ул, 76 E-mail: advokat527@mail.ru

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The TypeError comes from:

df=pd.read_html('http://www.advpalata28.ru/reestr/reestr-advokatov/')

Which returns a list of DataFrames instead of a DataFrame as you expected. The list only contains one DataFrame so using the following code should work:

import pandas as pd

df=pd.read_html('http://www.advpalata28.ru/reestr/reestr-advokatov/')
df = df[0]
df['Email'] = df[5].str.split('E-mail: ').str[1]

df.to_excel("link14.xlsx",encoding='utf-8')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading