Как поместить файл Excel для записи в python? - PullRequest
0 голосов
/ 21 июня 2020

enter image description here

I want to write 2 columns in python but my 2017 made of number and contain so many zero I desire to ignore all zeros from [2017] column. My output is working but I actually want to write to xlsx in files finally, ı will select two proper column and all zeros reject

I will make correlation but 0's create issue so how to delete all 0's from xlsx.

# -*- coding: utf-8 -*-
"""

Created on Sat Jun 20 22:05:12 2020

@author: pc
"""

import openpyxl
import xlsxwriter
from openpyxl import Workbook
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import matplotlib.pyplot as plt
from sklearn.metrics import r2_score
import os

df=pd.read_excel('insurance.xlsx')
data=df[2017]>0
data2=df[['TipAdı',2017]]
print(data[data2])

df1 = pd.DataFrame(data2)
df1.to_excel (r'C:\\Users\\pc\\Desktop\\insurancefiles\\new.xlsx')

исходные данные

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...