Skip to content

How to create river type dataset from pandas dataframe #630

Answered by raphaelsty
jacowp357 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @jacowp357,

The classic structure of datasets with River is a list of dictionary. Here is how to convert a pandas dataframe to a list of dictionary:

import pandas as pd

# Load Iris dataset.
df = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')

dataset = df.to_dict(orient = "records")

dataset
[
  {'sepal_length': 5.1,
    'sepal_width': 3.5,
    'petal_length': 1.4,
    'petal_width': 0.2,
    'species': 'setosa'},
   {'sepal_length': 4.9,
    'sepal_width': 3.0,
    'petal_length': 1.4,
    'petal_width': 0.2,
    'species': 'setosa'},
...
]

You can pass the list of dict to evaluate.progressive_val_score() 🙂

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@raphaelsty
Comment options

@jacowp357
Comment options

@MaxHalford
Comment options

@Divya216
Comment options

@MaxHalford
Comment options

Answer selected by MaxHalford
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants