stephenleo commited on
Commit
b61e914
·
1 Parent(s): 6988d55

update nrows limit

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -44,13 +44,14 @@ def load_data():
44
 
45
  # Minor cleanup
46
  data = data.dropna()
47
- data = data.reset_index(drop=True)
48
 
49
  # Load max 200 rows only
50
  st.write(f'Number of rows: {len(data)}')
51
- if len(data) > 200:
52
- data = data.iloc[:200]
53
- st.write(f'Only first 200 rows will be analyzed')
 
 
54
 
55
  # Prints
56
  st.write('First 5 rows of loaded data:')
@@ -176,10 +177,10 @@ def network_centrality(nx_net, topic_data):
176
  st.header('🏅 Most Important Papers')
177
 
178
  centrality_mapping = {
 
179
  'Closeness Centrality': nx.closeness_centrality,
180
  'Degree Centrality': nx.degree_centrality,
181
  'Eigenvector Centrality': nx.eigenvector_centrality,
182
- 'Betweenness Centrality': nx.betweenness_centrality,
183
  }
184
 
185
  cols = st.columns(3)
 
44
 
45
  # Minor cleanup
46
  data = data.dropna()
 
47
 
48
  # Load max 200 rows only
49
  st.write(f'Number of rows: {len(data)}')
50
+ if len(data) > 500:
51
+ data = data.sample(500, random_state=0)
52
+ st.write(f'Only random 500 rows will be analyzed')
53
+
54
+ data = data.reset_index(drop=True)
55
 
56
  # Prints
57
  st.write('First 5 rows of loaded data:')
 
177
  st.header('🏅 Most Important Papers')
178
 
179
  centrality_mapping = {
180
+ 'Betweenness Centrality': nx.betweenness_centrality,
181
  'Closeness Centrality': nx.closeness_centrality,
182
  'Degree Centrality': nx.degree_centrality,
183
  'Eigenvector Centrality': nx.eigenvector_centrality,
 
184
  }
185
 
186
  cols = st.columns(3)