Skip to content

Instantly share code, notes, and snippets.

@hernandohhoyos
Created August 4, 2022 17:29
Show Gist options
  • Save hernandohhoyos/d50cbc07040cd5b5a564f9d214d4e552 to your computer and use it in GitHub Desktop.
Save hernandohhoyos/d50cbc07040cd5b5a564f9d214d4e552 to your computer and use it in GitHub Desktop.
Generate CSV using pandas and numpy
import numpy as np
import pandas as pd
N = 10000
df = pd.DataFrame(
np.random.randint(999, 999999, size=(N, 7)), columns=list("ABCDEFG")
)
df["H"] = np.random.rand(N)
df["I"] = pd.util.testing.rands_array(10, N)
df["J"] = pd.util.testing.rands_array(10, N)
df.to_csv("random_10K.csv", sep=",")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment