In[1]: import pandas as pd import numpy as np pd.options.display.max_columns = 40 1. 选取多个DataFrame列 # 用列表选取多个列 In[2]: movie = pd.read_csv('data/movie.csv') movie_actor_director = movie[['actor_1_name', 'actor_2_name', 'actor_3_name SeanCheney 2018/10/10 4.6K0...
Randomly reorder a dataframe
This sort the dataframe but NOT the factor levels mutate(name=factor(name, levels=name)) %>% # This trick update the factor levels ggplot( aes(x=name, y=val)) + geom_segment( aes(xend=name, yend=0)) + geom_point( size=4, color="orange") + coord_flip() + theme_bw() + ...