filmov
tv
Append Values to pandas DataFrame in Python (Example) | Add, Concat & Combine a List as a New Row

Показать описание
R code of this video:
import pandas as pd # Load pandas library
my_data = pd.DataFrame({"x1":["a", "b", "c", "a", "a", "c", "b"], # Create pandas DataFrame
"x2":range(13, 20),
"x4":range(1, 8),
"x3":["a", "b", "c", "d", "e", "f", "g"]})
print(my_data) # Print second pandas DataFrame
my_values = ["w", "x", "y", "z"]
print(my_values)
# ['w', 'x', 'y', 'z']
print(data_new) # Print updated DataFrame
Follow me on Social Media:
import pandas as pd # Load pandas library
my_data = pd.DataFrame({"x1":["a", "b", "c", "a", "a", "c", "b"], # Create pandas DataFrame
"x2":range(13, 20),
"x4":range(1, 8),
"x3":["a", "b", "c", "d", "e", "f", "g"]})
print(my_data) # Print second pandas DataFrame
my_values = ["w", "x", "y", "z"]
print(my_values)
# ['w', 'x', 'y', 'z']
print(data_new) # Print updated DataFrame
Follow me on Social Media: