Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas random sample

# n: number of rows to be extracted randomly
# random_state fixed for reproducibility
# replace = True for extraction with replacement

df.sample(n=3, random_state=42, replace=False)
Comment

create random dataframe pandas

import numpy as np
import pandas as pd
df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))
Comment

PREVIOUS NEXT
Code Example
Python :: open link from python 
Python :: download pdf from url python 
Python :: save request response json to file python 
Python :: python random hex color 
Python :: jinja2 datetime format 
Python :: pandas convert header to first row 
Python :: pandas add days to date 
Python :: read_csv only certain columns 
Python :: DeprecationWarning: executable_path has been deprecated, please pass in a Service object 
Python :: spammer bot python 
Python :: How to config your flask for gmail 
Python :: how to get size of folder python 
Python :: for loop in df rows 
Python :: degree symbol in python 
Python :: zip list to dictionary python 
Python :: linux ubuntu install python 3.7 
Python :: keras model load 
Python :: get file name from url python 
Python :: display cv2 image in jupyter notebook 
Python :: verificar se arquivo existe python 
Python :: split string form url last slash 
Python :: python error get line 
Python :: sklearn plot confusion matrix 
Python :: tk table python 
Python :: tkinter change label text color 
Python :: install googlesearch for python 
Python :: print numpy version 
Python :: remove r and n from string python 
Python :: pandas columns starting with 
Python :: créer des variable dynamiques python 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =