5 ms·
The cheatsheet goes wrong already for the first example of declaring a df: - you could do a range in python (range(11, 14)) - columns are called col_1 & col_2 v
by rgavuliak 3y ago
The cheatsheet goes wrong already for the first example of declaring a df:
- you could do a range in python (range(11, 14))
- columns are called col_1 & col_2 vs a & b (both sets are horrible names)
- pandas defines index of 0, 1, 3, while Julia would most likely have 0, 1, 2?
- jstx1 3y agoAlso df.loc[1:3, :] doesn't get the first N rows. First because of 0-indexing, second because when your index isn't ordered integers, you'll get completely unexpected results with .loc.
- joeman1000 3y agoWhat do you mean? Julia is 1-indexed.
- rgavuliak 3y agoOk, in that case Python would be 0, 1, 3 and Julia 1, 2, 3. My point is that the example explicitly skips an index in the definition of a data frame for Python, but it doesn't for Julia.
- markkitti 3y agoSurely Python would not skip the 2.
- rgavuliak 3y agoThe code snippet explicitly defines the index to be 0, 1, 3. It may just be a typo, but if even simple examples are written sloppily, how can I trust the sheet: df = pd.DataFrame( {'col_1': [11, 12, 13], 'col_2': [21, 22, 23]}, index=[0, 1, 3])