filmov
tv
Create Empty pandas DataFrame in Python (2 Examples) | Initialize 0 Rows with & without Column Names
![preview_player](https://i.ytimg.com/vi/uSyzNtAN7zE/maxresdefault.jpg)
Показать описание
Python code of this video:
import pandas as pd # Load pandas
data_1 = pd.DataFrame() # Create empty DataFrame
print(data_1) # Print empty DataFrame
# Empty DataFrame
# Columns: []
# Index: []
data_2 = pd.DataFrame(columns = ["x1", "x2", "x3"]) # Create empty DataFrame with column names
print(data_2) # Print empty DataFrame with column names
# Empty DataFrame
# Columns: [x1, x2, x3]
# Index: []
Follow me on Social Media:
import pandas as pd # Load pandas
data_1 = pd.DataFrame() # Create empty DataFrame
print(data_1) # Print empty DataFrame
# Empty DataFrame
# Columns: []
# Index: []
data_2 = pd.DataFrame(columns = ["x1", "x2", "x3"]) # Create empty DataFrame with column names
print(data_2) # Print empty DataFrame with column names
# Empty DataFrame
# Columns: [x1, x2, x3]
# Index: []
Follow me on Social Media: