<｜begin▁of▁sentence｜>### Instruction:
Assuming you have two pandas DataFrames: edges_df with columns ['source', 'target', 'weight'], representing the source vertex, target vertex, and the weight of the edge between them, respectively, and vertices_df with columns ['name', 'attribute'] indexed from 0 to 3, representing vertex IDs, names, and an additional attribute. How would you use the igraph Graph.DataFrame function to create an undirected graph from these DataFrames, and ensure that the graph incorporates both edge weights and vertex attributes?
### Response:
import igraph as ig
import pandas as pd

# Define edges dataframe
edges_df = pd.DataFrame({
    'source': [0, 1, 2],
    'target': [1, 2, 3],
    'weight': [10, 20, 30]
})

# Define vertices dataframe
vertices_df = pd.DataFrame({
    'name': ['A', 'B', 'C', 'D'],
    'attribute': ['attr1', 'attr2', 'attr3', 'attr4']
})
vertices_df.index.name = 'id'

# Create graph from dataframes
g = ig.Graph.DataFrame(edges=edges_df, directed=False, vertices=vertices_df)

# Print graph summary
print(g.summary())
<|EOT|>
