{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import oss2\n", "from itertools import islice\n", "import pandas as pd\n", "columns = [\"id\",\"VIN\",\"VehModel\",\"VehState\",\"Time\",\"CellVoltage\",\"PackVoltage\",'CellMaxVolNum',\"CellMinVolNum\",'CellTemp','CellMaxTempNum','CellMinTempNum','PackCrnt','VehRmnRng','VehOdo','FltCode',\n", "'FltLvl','VehSpd','PedalAngle','PackSoc','MotorPwr','EnmTemp','InsulationRss','ChrgSta','GPS_lon','GPS_lat','GPS_alt',\n", " 'PowerAlreadyTime','BMSSta','ACSta','OncCmState','HVILSta','OfcAccumTime','OncAccumTime','BmsOncChgCp','BmsOfcPileOutputVol','BmsOfcPileOutputCur','BmsOfcCc','BmsOfcAllowed',\n", " 'OncOutCurrent','OncOutVoltage','OfcStationMaxOutVolt','OfcStationMinOutVolt','OfcStationMaxOutCrnt','OfcStationMinOutCrnt','BmsOfcgVoltageRequest','BmsOfcType','BmsOfcCurrentRequest',\n", " 'BmsOncChgRequest','BmsRequestOutputCurrent','BmsRequestOutputVoltage','BmsOncCc','BmsS2State','HvUpState','HvDownState','CellMaxVol','CellMinVol','CellMaxTemp','CellMinTemp','Tripmeter',\n", " 'VehAccX','VehAccY','StringAngle','PTCSta','PTCPwr','PosRlySta','NegRlySta','OfcPreRlySta','OfcRlySta','OfcPosChrgerTemp','OfcNegChrgerTemp','OncPosChrgerTemp','OncNegChrgerTemp',\n", " 'InstPwrCmsmtion','AvgPwrCmsmtion','SubPwrCmsmtion','BmsCellVoltDiff','DriveMode','BmsBatTempDiff','BmsClmThermalSts','BmsBatteryTotalCapacity','BmsBatteryAvaiCapacity',\n", " 'BmsOncChgCpConn','CellVoltRecTime','CellVoltTotalCount','CellVoltFrameNo','CellVoltFrameCount','CellTempTotalCount','SN','BatteryModel']\n", "auth = oss2.Auth('LTAI4FyoDnXMjqd78rdRDFHN', 'sdFl6vjM9l2rvWiUTzuFQb2xqjUoY5')\n", "bucket = oss2.Bucket(auth, \"https://oss-cn-hangzhou.aliyuncs.com\", 'ff-hezhong')\n", "df_data = pd.DataFrame(columns = columns) \n", "for b in islice(oss2.ObjectIterator(bucket,'alg/LUZAGAAA1MA038075/202202251410/'), 0):\n", " bucket.get_object_to_file(b.key, 'test.txt')\n", " df = pd.read_csv('test.txt', names=columns, sep=' ')\n", " df_data = pd.concat([df_data,df])" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "alg/LUZAGAAA1MA038075/202202251410/56311b72-3254-4dff-b6a8-33b2b2ab31c7.txt\n", "alg/LUZAGAAA1MA038075/202202251410/d5173cf1-87e2-4117-a200-b7c8d118fa18.txt\n", "alg/LUZAGAAA1MA038075/202202251410/eeb136bb-5170-4944-9008-a0dd3624ea8e.txt\n" ] } ], "source": [ "for b in oss2.ObjectIterator(bucket,'alg/LUZAGAAA1MA038075/202202251410/'):\n", " print(b.key)\n", "\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idVINVehModelVehStateTimeCellVoltagePackVoltageCellMaxVolNumCellMinVolNumCellTemp...BmsBatteryTotalCapacityBmsBatteryAvaiCapacityBmsOncChgCpConnCellVoltRecTimeCellVoltTotalCountCellVoltFrameNoCellVoltFrameCountCellTempTotalCountSNBatteryModel
\n", "

0 rows × 90 columns

\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [id, VIN, VehModel, VehState, Time, CellVoltage, PackVoltage, CellMaxVolNum, CellMinVolNum, CellTemp, CellMaxTempNum, CellMinTempNum, PackCrnt, VehRmnRng, VehOdo, FltCode, FltLvl, VehSpd, PedalAngle, PackSoc, MotorPwr, EnmTemp, InsulationRss, ChrgSta, GPS_lon, GPS_lat, GPS_alt, PowerAlreadyTime, BMSSta, ACSta, OncCmState, HVILSta, OfcAccumTime, OncAccumTime, BmsOncChgCp, BmsOfcPileOutputVol, BmsOfcPileOutputCur, BmsOfcCc, BmsOfcAllowed, OncOutCurrent, OncOutVoltage, OfcStationMaxOutVolt, OfcStationMinOutVolt, OfcStationMaxOutCrnt, OfcStationMinOutCrnt, BmsOfcgVoltageRequest, BmsOfcType, BmsOfcCurrentRequest, BmsOncChgRequest, BmsRequestOutputCurrent, BmsRequestOutputVoltage, BmsOncCc, BmsS2State, HvUpState, HvDownState, CellMaxVol, CellMinVol, CellMaxTemp, CellMinTemp, Tripmeter, VehAccX, VehAccY, StringAngle, PTCSta, PTCPwr, PosRlySta, NegRlySta, OfcPreRlySta, OfcRlySta, OfcPosChrgerTemp, OfcNegChrgerTemp, OncPosChrgerTemp, OncNegChrgerTemp, InstPwrCmsmtion, AvgPwrCmsmtion, SubPwrCmsmtion, BmsCellVoltDiff, DriveMode, BmsBatTempDiff, BmsClmThermalSts, BmsBatteryTotalCapacity, BmsBatteryAvaiCapacity, BmsOncChgCpConn, CellVoltRecTime, CellVoltTotalCount, CellVoltFrameNo, CellVoltFrameCount, CellTempTotalCount, SN, BatteryModel]\n", "Index: []\n", "\n", "[0 rows x 90 columns]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "interpreter": { "hash": "5ac93a79b26608c768d42fbd754dd4f69161017bfc4d38cb4b18d60e5198dbca" }, "kernelspec": { "display_name": "Python 3.6.2 ('ana_py36')", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.12" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }