Reputation: 21
I'm getting the following error from the code below:
***File "<ipython-input-61-517e344a129d>", line 1
df.sort_values(by "Script Count", "Drug Name"), axis=0, ascending=True, inplace=False, kind='quicksort',
^
SyntaxError: invalid syntax*** (the carrot is pointing to the second " following "Script Count")
Code:
import pandas as pd
import numpy as np
df = pd.read_csv('/Users/rmartin/Desktop/DE_Highmark.csv')
df.sort_values(by "Script Count", "Drug Name"), axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last')
I know this must be super simple, but I've driven myself crazy trying to figure it out. I'm trying to sort the dataframe based on the "Script Count"
and "Drug Name"
columns from a dataframe. The CSV was successfully imported as a dataframe, but the sort function is giving me trouble.
Upvotes: 2
Views: 496