Python Forum
Attribute error in Dataframes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Attribute error in Dataframes
#1
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import webbrowser
website='https://en.wikipedia.org/wiki/NFL_win-loss_records'
webbrowser
output--><module 'webbrowser' from 'C:\\Users\\Anish\\anaconda3\\lib\\webbrowser.py'>

webbrowser.open
output--> <function webbrowser.open(url, new=0, autoraise=True)>

webbrowser.open(website)
Output--> True

nfl_frame = pd.read_clipboard()
ngl_frame

Output: Rank Team GP Won Lost Tied Pct. First NFL Season Division
0 1 Dallas Cowboys 914 520 388 6 0.572 1960 NFC East
1 2 Green Bay Packers 1,368 756 574 38 0.567 1921 NFC North
2 3 New England Patriots 916 512 395 9 0.564 1960 AFC East
3 4 Chicago Bears 1,402 769 591 42 0.563 1920 NFC North
4 5 Baltimore Ravens 384 214 169 1 0.559 1996 AFC North

Input--> nfl_frame.Rank
Output-->--------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-23-660136ad565c> in <module>
----> 1 nfl_frame.Rank

~\anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
5272 if self._info_axis._can_hold_identifiers_and_holds_name(name):
5273 return self[name]
-> 5274 return object.__getattribute__(self, name)
5275
5276 def __setattr__(self, name: str, value) -> None:

AttributeError: 'DataFrame' object has no attribute 'Rank'
Reply
#2
Use code tags.
Read as html pd.read_html the pick out correct table,the it should work.
Here a NoteBook.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using SHAP Library for my LSTM model - "Attribute Error" vatsalmtailor 0 2,102 Jul-13-2022, 04:34 PM
Last Post: vatsalmtailor
  error "list object has no attribute transpose()" usercat123 4 4,282 Jan-28-2022, 12:01 PM
Last Post: usercat123
  Attribute Error Raiden_Arctica 4 4,158 Mar-13-2021, 11:09 AM
Last Post: Raiden_Arctica
  Attribute error - Sympy VictorG8 1 5,004 Apr-09-2020, 06:03 PM
Last Post: snippsat
  Merging two DataFrames based on indexes from two other DataFrames lucinda_rigeitti 0 1,756 Jan-16-2020, 08:36 PM
Last Post: lucinda_rigeitti
  NLTK Download Attribute error laila1a 1 8,606 Jan-27-2019, 12:03 AM
Last Post: Larz60+
  [split] np.arrange error - no attribute gyan 2 6,994 Aug-19-2018, 05:38 PM
Last Post: micseydel
  Attribute Error while using tensor flow pratheep 2 6,618 Mar-16-2018, 10:50 AM
Last Post: pratheep
  np.arrange error - no attribute pksherard 3 22,793 Aug-16-2017, 09:54 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020