Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to Create a Pandas DataFrame of Random Integers

"In this quick guide, we're going to create a Pandas DataFrame of random integers with arbitrary length."
import numpy as np
import pandas as pd
import string

string.ascii_lowercase

n = 5
m = 7

cols = string.ascii_lowercase[:m]

df = pd.DataFrame(np.random.randint(0, n,size=(n , m)), columns=list(cols))

df
Source by www.interviewqs.com #
 
PREVIOUS NEXT
Tagged: #How #Create #Pandas #DataFrame #Random #Integers
ADD COMMENT
Topic
Name
7+5 =