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 :
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')