【问题标题】:I want to replace pandas with the csv module我想用 csv 模块替换熊猫
【发布时间】:2021-05-19 13:31:38
【问题描述】:

我想在这个程序中使用 csv 模块而不是 pandas,我该怎么做?目前,我无法正确安装和工作 pandas,所以我想使用 csv 模块。

这是我的代码:

import time
import pandas as pd
from datetime import datetime
import webbrowser

def sign_in(meetinglink):
    webbrowser.open(meetinglink)  
  
df = pd.read_csv('/Users/3021118/Applications/Meeting-Launcher/timings.csv')

while True:
    now = datetime.now().strftime("%H:%M")
    if now in str(df['timings']):
        row = df.loc[df['timings'] == now]
        m_link = str(row.iloc[0,1])

        sign_in(m_link)
        time.sleep(10)
        print('MEETING JOINED!')

这是 timings.csv 的样子:https://i.stack.imgur.com/gTPlT.png

【问题讨论】:

    标签: python python-3.x pandas csv


    【解决方案1】:

    你可以试试这个 - 修改适用

    import csv
    with open("file_name.csv", "rt") as csvfile:
        for row in csv.reader(csvfile, delimiter=',', quotechar='"'):
             #your logic
    

    【讨论】:

      猜你喜欢
      • 2023-03-06
      • 2022-11-26
      • 2017-03-12
      • 2021-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多