I've successfully gathered data into a dictionary called 'data' with Sleenium & Python. the output of that dict looks like this:
data = {'Price': '£1,995', 'Title': 'BMW X3', 'Key Specs': ['2006 (56 reg)', 'SUV', '110,000 miles', '2.0L', '150BHP', 'Manual', 'Diesel'], 'Year': '2006 (56 reg)', 'Type': 'SUV', 'Milage': '110,000 miles', 'Displacement': '2.0L', 'Power': '150BHP', 'Transmission': 'Manual', 'Fuel': 'Diesel'}
I've created a Pandas DataFrame called 'df' at the start of the script, see below:
df = pd.DataFrame(columns=['Title', 'Price', 'Year', 'Type', 'Milage', 'Displacement', 'Power', 'Transmission', 'Fuel', 'Owner Count', 'Key Specs', 'Attention Grabber', 'URL'])
Sadly for some reason I'm not successful in appending the data to my df. via the following line (within a loop):
df = df.append(data, ignore_index=True)
Can you pls help?
The error message is as follows:
Empty DataFrame
Columns: [Title, Price, Year, Type, Milage, Displacement, Power, Transmission, Fuel, Owner Count, Key Specs, Attention Grabber, URL]
Index: []
from Pandas pd not populating with .append
No comments:
Post a Comment