Skip to content

Instantly share code, notes, and snippets.

@quantra-go-algo
Created March 6, 2024 17:54
Show Gist options
  • Save quantra-go-algo/4d70d9b5d98f9b88447de9456af59f50 to your computer and use it in GitHub Desktop.
Save quantra-go-algo/4d70d9b5d98f9b88447de9456af59f50 to your computer and use it in GitHub Desktop.
# Import the libraries
import pandas as pd
import cudf
# Creating a Pandas DataFrame
pandas_data = {
'A': [1, 2, 3, 4, 5],
'B': [10, 20, 30, 40, 50],
'C': ['a', 'b', 'c', 'd', 'e']
}
pandas_df = pd.DataFrame(pandas_data)
# Display the Pandas DataFrame
print("Pandas DataFrame:")
print(pandas_df)
# Convert Pandas DataFrame to cuDF DataFrame
cudf_df = cudf.DataFrame.from_pandas(pandas_df)
# Display the cuDF DataFrame
print("cuDF DataFrame:")
print(cudf_df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment