0

I am using Panda version is 1.3.5 and I am running into an error when I am trying to use the sort_values function.

code

founded_edvideos_list = find_matching_posts_forupdate(video_id_list, stop_at_page=stop_at_page)
founded_edvideos_df = pd.DataFrame(founded_edvideos_list)
founded_edvideos_df = pd.sort_values(by=['post_id'], ascending=True)

The last line gives an error

getattr__ raise AttributeError(f"module 'pandas' has no attribute '{name}'") AttributeError: module 'pandas' has no attribute 'sort_values'

When I print the dataframe, it looks like the following, so I should be able to use the post_id. I have checked the documentation and can't seem to find my issue.

dataframe

post_id                                         title  ...      vid_type vid_record
0    12994              Trailblazer Melba Pattillo Beals  ...  [6923, 6926]     [6929]
1    12992                         Trailblazer Asha Prem  ...        [6923]     [6929]
2    12894  Trailblazers Melisa Mujanovic and Nina Nukic  ...  [6923, 6926]     [6929]

1 Answer 1

3

You're calling pandas.sort_values instead of calling sort_values on an instance of pandas.Dataframe. Your sorting line should likely be:
founded_edvideos_df = founded_edvideos_df.sort_values(by=['post_id'], ascending=True)

Sign up to request clarification or add additional context in comments.

1 Comment

Duh. Thank you so much. I see now. I wasn't calling the frame.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.