質問編集履歴

2

コード

2020/07/10 13:13

投稿

pon244
pon244

スコア59

test CHANGED
File without changes
test CHANGED
@@ -6,17 +6,15 @@
6
6
 
7
7
  【実行結果】
8
8
 
9
- ![イメージ説明](4ffa27550298632d847bc2b4433f17e6.png)
9
+ ![イメージ説明](8f93c9f106478889a45f639940450ddd.png)
10
10
 
11
11
 
12
12
 
13
- 【したこと、試したこと
13
+ い結果
14
14
 
15
- コラムHuawei_EuropeSamsungMobileにそぞれ数字行きたい
15
+ 現状ままだと毎日更新すると毎日の推移が見ない。全部同じ数字します
16
16
 
17
- Date日付9月1仮設定しいますがイメージとては毎日そこ毎日の数字を入れてたいです。
17
+ 今日更新したのは一番上、9/1に残って、明日更新たら9/2にいくようにしたいです。
18
-
19
- For分で入れてみましたが、うまく行かないので、基礎的な質問ですが、ご教授いただきたいです。
20
18
 
21
19
 
22
20
 
@@ -48,17 +46,29 @@
48
46
 
49
47
 
50
48
 
49
+ #データフレームを作成すr。
50
+
51
+
52
+
51
53
  df_TW_Followers = pd.DataFrame()
52
54
 
53
55
  df_TW_Followers = pd.DataFrame(columns=["SamsungMobile","Huawei_Europe"],index=['09/01','09/02','09/03'])
54
56
 
55
57
  TwitterHandle=["SamsungMobile","Huawei_Europe"]
56
58
 
57
- df_TW_Followers
59
+ df_TW_Followers.index
58
60
 
59
61
  SamsungMobile = api.get_user(screen_name="SamsungMobile")
60
62
 
63
+ Huawei_Europe = api.get_user(screen_name="Huawei_Europe")
64
+
61
65
  SamsungMobile.followers_count
66
+
67
+ Huawei_Europe.followers_count
68
+
69
+ #forで格納する
70
+
71
+
62
72
 
63
73
  #forで格納する
64
74
 
@@ -70,15 +80,17 @@
70
80
 
71
81
  print(i + " done!")
72
82
 
73
- df_TW_Followers.at[str(i),"SamsungMobile"] =url_financials.followers_count
83
+ df_TW_Followers.at[df_TW_Followers.index,"SamsungMobile"] =SamsungMobile.followers_count
74
84
 
75
-
85
+ df_TW_Followers.at[df_TW_Followers.index,"Huawei_Europe"] =Huawei_Europe.followers_count
76
86
 
77
87
 
78
88
 
79
89
 
80
90
 
81
91
  print("ALL done!")
92
+
93
+
82
94
 
83
95
  ```
84
96
 

1

修正

2020/07/10 13:13

投稿

pon244
pon244

スコア59

test CHANGED
File without changes
test CHANGED
@@ -81,3 +81,19 @@
81
81
  print("ALL done!")
82
82
 
83
83
  ```
84
+
85
+
86
+
87
+ 【欲しい結果】
88
+
89
+ 下記のように入れたいですが、現状は新たに行にHuawei_Europeが入ってしまいます
90
+
91
+ |列1|Huawei_Europe|SamsungMobile|
92
+
93
+ |:--|:--:|--:|
94
+
95
+ |9/1|100|200|
96
+
97
+ |9/2|200|222|
98
+
99
+ |9/3|300|230|