Python> Output numbers from 1 to 100, 501 to 600> For csv

python


Operating environment
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 14.04 LTS desktop amd64
TensorFlow v0.11
cuDNN v5.1 for Linux
CUDA v8.0
Python 2.7.6
IPython 5.1.0 -- An enhanced Interactive Python.

Create the following csv file

--First column: 1 to 100 --Second row: 501 to 600

prep_seq_data.py


import numpy as np

numdata=100
x_data = np.linspace(1,100,100)
y_data = np.linspace(501,600,100)

#print(x_data)
#print(y_data)

for xs, ys in zip(x_data, y_data):
	print '%d,%d' % (xs, ys)

result


$ python prep_seq_data.py > input2.csv 
$ head input2.csv 
1,501
2,502
3,503
4,504
5,505
6,506
7,507
8,508
9,509
10,510
$ tail input2.csv 
91,591
92,592
93,593
94,594
95,595
96,596
97,597
98,598
99,599
100,600

Recommended Posts

Python> Output numbers from 1 to 100, 501 to 600> For csv
Output to csv file with Python
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Csv output from Google search with [Python]! 【Easy】
[Python] From morphological analysis of CSV data to CSV output and graph display [GiNZA]
Post from Python to Slack
Cheating from PHP to Python
Anaconda updated from 4.2.0 to 4.3.0 (python3.5 updated to python3.6)
Switch from python2.7 to python3.6 (centos7)
Connect to sqlite from python
[Python-pptx] Output PowerPoint font information to csv with python
Python script to create a JSON file from a CSV file
~ Tips for beginners to Python ③ ~
Introduction to Python For, While
Convert from Pandas DataFrame to System.Data.DataTable using Python for .NET
[For beginners] Script within 10 lines (4. Connection from python to sqlite3)
Introduction to Python for VBA users-Calling Python from Excel with xlwings-
Python code for writing CSV data to DSX object storage
Output product information to csv using Rakuten product search API [Python]
Call Matlab from Python to optimize
[Python] Write to csv file with Python
Create folders from '01' to '12' with python
Post from python to facebook timeline
Output from Raspberry Pi to Line
Connect to utf8mb4 database from python
Notes for me python csv graph
Python (from first time to execution)
Post images from Python to Tumblr
Tips for calling Python from C
Notes for Python file input / output
[Django] Command to output QuerySet to csv
[Python] Convert natural numbers to ordinal numbers
Convert decimal numbers to n-ary numbers [python]
How to access wikipedia from python
Python to switch from another language
An introduction to Python for non-engineers
[Python] Change the alphabet to numbers
Did not change from Python 2 to 3
Update Python on Mac from 2 to 3
From building a Python environment for inexperienced people to Hello world
Various ways to create an array of numbers from 1 to 10 in Python.
[Python] How to convert db file to csv
[Python] Fluid simulation: From linear to non-linear
From Python to using MeCab (and CaboCha)
Data input / output in Python (CSV, JSON)
[Python] How to display random numbers (random module)
Memo to ask for KPI with python
Output color characters to pretty with python
How to update Google Sheets from Python
"Python AI programming" starting from 0 for windows
[Python] Convert csv file delimiters to tab delimiters
Convert from PDF to CSV with pdfplumber
Send a message from Python to Slack
Output Python log to console with GAE
Private Python handbook (updated from time to time)
Note for Pyjulia calling Julia from Python
I want to use jar from python
Convert from katakana to vowel kana [python]
Push notification from Python server to Android
Porting and modifying doublet-solver from python2 to python3.