Skip to content

Dataframe Creation Methods

DCMS-1: Dictionary of Lists

pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
Creates a DataFrame from a dictionary where keys become column names and list values become the data for each column. This is fully supported in frame-check as the primary use case.

Not Supported

DCMS-2: List of Dictionaries

pd.DataFrame([{'col1': 1, 'col2': 3}, {'col1': 2, 'col2': 4}])
Creates a DataFrame where each dictionary represents a row, with keys as column names.

Not Supported

DCMS-3: Dictionary of Series

pd.DataFrame({'col1': pd.Series([1, 2]), 'col2': pd.Series([3, 4])})
Similar to dictionary of lists, but uses pandas Series objects instead.

Not Supported

DCMS-4: NumPy Array

pd.DataFrame(np.array([[1, 2], [3, 4]]), columns=['col1', 'col2'])
Creates a DataFrame from a NumPy array with explicitly defined column names.

Not Supported

DCMS-5: List of Lists

pd.DataFrame([[1, 2], [3, 4]], columns=['col1', 'col2'])
Creates a DataFrame where each inner list represents a row, with column names provided separately.

Not Supported

DCMS-6: From CSV

pd.read_csv('file.csv', usecols=["a","b"])
Loads data from a CSV file into a DataFrame.

Supported

DCMS-7: From JSON

pd.read_json('file.json')
Loads data from a JSON file into a DataFrame.

Not Supported

DCMS-8: From SQL

pd.read_sql('SELECT * FROM table', connection)
Loads data from a SQL query into a DataFrame.

Not Supported

DCMS-9: From Excel

pd.read_excel('file.xlsx')
Loads data from an Excel file into a DataFrame.

Not Supported

DCMS-10: From Parquet

pd.read_parquet('file.parquet')
Loads data from a Parquet file into a DataFrame.

Not Supported

DCMS-11: Empty DataFrame

pd.DataFrame()
Creates an empty DataFrame with no columns or rows.

Not Supported

DCMS-12: From Index

pd.DataFrame(index=['a', 'b'], columns=['col1', 'col2'])
Creates an empty DataFrame with specified index and columns.

Not Supported

DCMS-13: From Scalar

pd.DataFrame({'col1': 1}, index=[0, 1, 2])
Creates a DataFrame by broadcasting scalar values across specified indices.

Not Supported

DCMS-14: Copy Constructor

pd.DataFrame(other_df)
Creates a DataFrame as a copy of another DataFrame.

Not Supported

DCMS-15: From Records

pd.DataFrame.from_records([('a', 1), ('b', 2)], columns=['col1', 'col2'])
Creates a DataFrame from a structured array, records, or sequence of tuples.

Not Supported

DCMS-16: From Dict

pd.DataFrame.from_dict({'col1': [1, 2], 'col2': [3, 4]})
Creates a DataFrame from a dictionary using the class method.

Not Supported