Closed exsell-jc closed 2 years ago
tp.read_csv()
works when I use it - what error do you get?
As far as the rest - if you are using pl.read_csv()
it will return a polars
DataFrame instead of a tidypolars
Tibble. In that case you won't be able to use tidypolars
methods on them. polars
has a .drop()
method that only allows one input which is why they were working separately in your example. You would need to convert the DataFrame to a Tibble using tp.from_polars(df)
so you can use the tidypolars
.drop()
method.
However you should be able to use tp.read_csv()
here, in which case you wouldn't need the tp.from_polars(df)
step.
import tidypolars as tp
url = f'https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-05-24/Scrumqueens-data-2022-05-23.csv'
df = tp.read_csv(file = url)
df = df.drop('...1', 'Notes')
df_names = df.names
df.head()
┌─────────────┬─────────────┬─────────┬─────────┬─────┬────────┬────────┬─────────────┬────────────┐
│ Date ┆ Team 1 ┆ Score 1 ┆ Score 2 ┆ ... ┆ Series ┆ Margin ┆ Winner ┆ Loser │
│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ str ┆ str ┆ str ┆ ┆ i64 ┆ str ┆ str ┆ str │
╞═════════════╪═════════════╪═════════╪═════════╪═════╪════════╪════════╪═════════════╪════════════╡
│ 1997-03-15 ┆ New Zealand ┆ 54 ┆ 0 ┆ ... ┆ 1 ┆ 54 ┆ New Zealand ┆ Japan │
│ ┆ Wild Ducks ┆ ┆ ┆ ┆ ┆ ┆ Wild Ducks ┆ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 1997-03-15 ┆ England ┆ 10 ┆ 7 ┆ ... ┆ 1 ┆ 3 ┆ England ┆ Australia │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 1997-03-15 ┆ Canada ┆ 31 ┆ 0 ┆ ... ┆ 1 ┆ 31 ┆ Canada ┆ Netherland │
│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ s │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 1997-03-15 ┆ Hong Kong ┆ 12 ┆ 5 ┆ ... ┆ 1 ┆ 7 ┆ Hong Kong ┆ Fiji │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 1997-03-15 ┆ United ┆ 26 ┆ 5 ┆ ... ┆ 1 ┆ 21 ┆ United ┆ Scotland │
│ ┆ States ┆ ┆ ┆ ┆ ┆ ┆ States ┆ │
└─────────────┴─────────────┴─────────┴─────────┴─────┴────────┴────────┴─────────────┴────────────┘
It works like magic now, thanks
Really new to the library, but looking at the documentation did not really help with understanding.
Problem 1
Problem 2
Problem 3
What am I missing, exactly?